Open jcouv opened 4 years ago
Would these warnings only be suppressed for the "standard" Linq implementations that have the expected semantics, or for all query expressions (even those that do not have the expected semantics)?
Note that OfType
currently can be used to filter out nulls whilst getting the correct return type. But perhaps there are more cases where this would not apply.
Nullable analysis of LINQ queries
Summary
Nullable analysis of LINQ queries (LDM expressed interested to handle
Where
, needs design proposal)Motivation
Range variables in LINQ queries are currently treated as oblivious to minimize annoyances. Most of the annoyance results from our inability to recognize method calls that filter out
null
elements, such as.Where(i => i is not null)
.Detailed design
TBD
Unresolved questions
Where
methods?Design meetings
Split issue from https://github.com/dotnet/csharplang/issues/3868 https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-09-28.md#nullability-improvements https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-09-06.md#nullable-analysis-of-linq-queries