-
Notifications
You must be signed in to change notification settings - Fork 829
Closed
Labels
Milestone
Description
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
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
New