The token `notnull`. Is it a keyword? Is it explicitly not a keyword?
In PR #830, this text was not included in the updates for nullable reference types:
The token
notnullis neither a keyword nor a contextual keyword. When it is encountered, it will either:
- Bind to a type named
notnull- Bind to no type, in which case, it is interpreted as the nonnullable type constraint.
Should this text be added to the text for the notnull constraint?
#830 also includes a large example starting at line 503
Do we want to include that example as well.
Other changes in #830 have been reviewed by me and @RexJaeschke . They are either included, or have been excluded by design.
I think by the definition of contextual keyword (§6.4.4) notnull is one, just like unmanaged is – so add it to §6.4.4
The similarity to unmanaged should carry over to how it is described. So in §15.2.5 we already have:
Because
unmanagedis not a keyword, in primary_constraint the unmanaged constraint is always syntactically ambiguous with class_type. For compatibility reasons, if a name lookup (§12.8.4) of the nameunmanagedsucceeds it is treated as aclass_type. Otherwise it is treated as the unmanaged constraint.
So for notnull we can use:
Because
notnullis not a keyword, in primary_constraint the notnull constraint is always syntactically ambiguous with class_type. For compatibility reasons, if a name lookup (§12.8.4) of the namenotnullsucceeds it is treated as aclass_type. Otherwise it is treated as the notnull constraint.
and insert it into §15.2.5.
Note that the description of nameof follows the same pattern as well.
@Nigel-Ecma to create a PR along the lines he's outlined.
Addressed by PR #1258