-
Notifications
You must be signed in to change notification settings - Fork 90
Add support for nonnull constraints #830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b37ce98
to
1ece5c4
Compare
Rebased on latest draft-v8 on 09/25/2023 |
@BillWagner On yesterday’s TG2 call, you wondered if you had resolved this PR as part of your other nullable-related work, and I offered to take a look. Looking at the Files changed and the current version of classes.md, I see the following:
So the remaining question is, "Did we decide to reject Item 3, or do we still need to look at that?" I'm guessing the latter. |
See #1246 |
@@ -490,7 +491,49 @@ Any constraints shall be consistent among dependent type parameters. If type par | |||
|
|||
It is valid for `S` to have the value type constraint and `T` to have the reference type constraint. Effectively this limits `T` to the types `System.Object`, `System.ValueType`, `System.Enum`, and any interface type. | |||
|
|||
If the `where` clause for a type parameter includes a constructor constraint (which has the form `new()`), it is possible to use the `new` operator to create instances of the type ([§12.8.17.2](expressions.md#128172-object-creation-expressions)). Any type argument used for a type parameter with a constructor constraint shall be a value type, a non-abstract class having a public parameterless constructor, or a type parameter having the value type constraint or constructor constraint. | |||
The token `notnull` is neither a keyword nor a contextual keyword. When it is encountered, it will either: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per #1246, we believe it is a contextual keyword.
If the `where` clause for a type parameter includes a constructor constraint (which has the form `new()`), it is possible to use the `new` operator to create instances of the type ([§12.8.17.2](expressions.md#128172-object-creation-expressions)). Any type argument used for a type parameter with a constructor constraint shall be a value type, a non-abstract class having a public parameterless constructor, or a type parameter having the value type constraint or constructor constraint. | ||
The token `notnull` is neither a keyword nor a contextual keyword. When it is encountered, it will either: | ||
|
||
- Bind to a type named `notnull` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gafter pointed out it could be an alias - we can just strike "named notnull
", or see @Nigel-Ecma's wording in #1246.
Closing as #1256 involves creating a replacement for this. |
@RexJaeschke - please don't delete the branch for this PR, as I'll want to copy from it... |
No description provided.