You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
F# compiler generates an unexpected error when building code containing an abstract generic method declaration. Similar non-generic code compiles with no errors.
Here's an example:
Non-generic version - compiles with no errors:
type IMyInterface =
abstract member Sort: int list -> int list
Generic version
type IMyInterface =
abstract member Sort<'T>: 'T list -> 'T list
fails to compile producing the following (somewhat cryptic) errors:
[FS0035] This construct is deprecated: ':' is not permitted as a character in operator names and is reserved for future use
[FS0010] Unexpected quote symbol in member definition. Expected ':' or other token.
[FS0010] Unexpected keyword 'type' in implementation file
To make the code compile I had to add a space before the colon:
type IMyInterface() =
abstract member Sort<'T> : 'T list -> 'T list
// note the space ^
It's inconsistent with the non-generic version which compiles with or without a space before the colon.
Seems to be a grammar definition issue...
Related information
OS: Ubuntu 24.04
.NET: 8.0.11
Editing Tools: JetBrains Rider
The text was updated successfully, but these errors were encountered:
F# compiler generates an unexpected error when building code containing an abstract generic method declaration. Similar non-generic code compiles with no errors.
Here's an example:
Non-generic version - compiles with no errors:
Generic version
fails to compile producing the following (somewhat cryptic) errors:
To make the code compile I had to add a space before the colon:
It's inconsistent with the non-generic version which compiles with or without a space before the colon.
Seems to be a grammar definition issue...
Related information
The text was updated successfully, but these errors were encountered: