Improve Error Reporting: Make FS0039 easier to read at a glance.
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
## What
The following error message is super common and could be made less intimidating:
```fsharp
type Person = { Name : string }
let isaac = { Name = "Isaac" }
let fullName = isaac.Fooo + " Abraham" // The type 'Person' does not define the field, constructor or member 'Fooo'.
```
## Why
The error message makes perfect sense, but for the beginner I feel it could be made more welcoming. In addition, the fact that it shows the type rather than the symbol name is a little confusing - especially if that type has been inferred.
## How
I would prefer to see an error something like as follows:
* `isaac.Fooo` does not exist (`isaac` is type `Person`).
* Unknown member `isaac.Fooo` (`isaac` is type `Person`).
Notice that we use the same symbol name and path as the actual code sample, which hopefully draws people's attention to the source of the issue. In the current error message, you have to read all the way to the end to see what the issue is.
I suppose we could keep the current "type-oriented" message but still improve it e.g.:
* `Fooo` does not exist on the type `Person`.
* `Fooo` does not exist on this symbol, which has type `Person`.
I'm not sure when else this error message is shown, so it's possible I've missed some other obvious cases etc.
Contributor guide
Assessment
This issue has not been assessed yet.