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
{{ message }}
Repository navigation
Better diagnostics for nullness inference related errors #17433
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."
We don't differentiate between collections and other types. string and string array are no different for us. This would probably be better solved in analyzers, rather than typechecker.
Activity
vzarytovskii commentedon Jul 23, 2024
We don't differentiate between collections and other types.
stringandstring arrayare no different for us. This would probably be better solved in analyzers, rather than typechecker.T-Gro commentedon Jul 31, 2024
Related to: #17409
T-Gro commentedon Jul 31, 2024
Option: Specialize type unification for list/array/sequence builders.
T-Gro commentedon Jul 31, 2024
Diagnostics can offer: Explicit annotation or "be first" rule.