Search code examples
parsingcompiler-errorsf#compiler-bug

Is this an F# 2.0 parser bug?


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?


Solution

  • 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.