2

Microsoft (R) F# 2.0 Interactive build 4.0.40219.1

I'm trying to define new record type:

type TestOptions =
   { perRunGC : bool;
     collectGCStat : bool;
   }

All is fine, but let's add one more field:

type TestOptions =
   { perRunGC : bool;
     collectGCStat : bool;
     highPriority : bool;
   }               ^

And I am getting parser error in a position marked above:

error FS0010: Unexpected character ' ' in field declaration

What's wrong with my code? Is it compiler bug?

sepp2k
  • 363,768
  • 54
  • 674
  • 675
controlflow
  • 6,667
  • 1
  • 31
  • 55
  • 8
    Compiles fine for me. Do you perhaps have a non-breaking space in your source file (which somehow got converted to a regular space when pasting it here)? – sepp2k Feb 27 '12 at 18:30
  • @sepp2k, oh, just removed the space and typed again - works fine! please, add the answer! Thank you! – controlflow Feb 27 '12 at 18:34

1 Answers1

6

Errors like this are often caused by unicode characters in your source file.

In this case you probably have a non-breaking space (or any other kind of special space) instead of a regular space at the location where the compiler chokes.

sepp2k
  • 363,768
  • 54
  • 674
  • 675
  • The code was copied from the blog that uses `SyntaxHighlighter` js script to highlight F# source code. Double click on code snippet turn the snippet into ` – controlflow Feb 27 '12 at 18:41