Better diagnostics for nullness inference related errors
Open
Area-Diagnostics
Area-Nullness
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
I think it would be good to be more explicit about nullness inference happening behind the scenes.
For the code
```
let xs = [| ""; ""; null |]
```
we'll get
> Nullness warning: The type 'string' does not support 'null'
It would be helpful to have something like
> "xs was inferred to have the type `string[]` but got null among its values. Either explicitly specify null in the return type (`(string | null)[]`), or remove null from the collection - or suppress the warning but no please don't."
_Originally posted by @psfinaki in https://github.com/dotnet/fsharp/pull/15181#discussion_r1679527189_
Contributor guide
Assessment
This issue has not been assessed yet.