-
Notifications
You must be signed in to change notification settings - Fork 93
Description
These are things that should be spelled out in the nullable reference types feature specification:
-
The handling of a lifted operator (if a comparison operator, the return type is still
bool
, but other operators have value types turned intoNullable
of that value type, and reference types are made nullable. If either operand might be null, then the result might be null if the resulting return type is capable containing null. -
In order to preserve the safety in the face of unconstrained type parameters, we warn immediately when a null value of such a type is introduced. This is a safety warning. The contexts in which such a warning are given are
-
default
anddefault(T)
-
null
conversion toT
(whenT
is known to be ref type) -
e?.M()
when the return type isT
-
dynamic conversion or cast to
T
when the dynamic might be null -
explicit conversion to
T
-
e as T
when there is not an implicit conversion from the type ofe
toT
-
a call to a method like
FirstOrDefault()
that is annotated with `[MaybeNull] (not yet implemented)