Closed yaakov-h closed 4 years ago
The second example seems like invalid syntax since the await has a higher precedence than the null-coalescing operator.
Updated
Should probably also be aware of as
in the same contexts
foreach (var item in (foo as IEnumerable))
or
await (foo as Task)
This might be easier with C# 8 (I assume Roslyn 3.0?), because the compiler will track the nullability state of the expression... hopefully that will be exposed.
There doesn't seem to be anything to implement here beyond what nullable reference types already provides.
Warning:
OK:
Warning:
OK: