Improve error reporting: property syntax can't be remembered
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
# What
When I try to define a class with getters/setters (and I forget how this is supposed to be defined):
```fsharp
type Foo() =
member __.Prop : int with get,set
```
The compiler gives
> Error: A type definition requires one or more members or other declarations. If you intend to define an empty class, struct or interface, then use 'type ... = class end', 'interface end' or 'struct end'.
# Why
The syntax for some members (not only properties) can be difficult to remember when not used frequently (modules and functions are fine, but some frameworks insist on having properties, instance methods, etc.).
# How
In my case, there is "with get,set" which is a clue I want a property, although I should have typed
```fsharp
type Foo() =
member val Prop = 0 with get, set
```
I wish the compiler could help me out without resorting to google search.
related #1103
Contributor guide
Assessment
This issue has not been assessed yet.