-
Notifications
You must be signed in to change notification settings - Fork 86
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
Specify generic constraints added to support nullable reference types in C# 8 #1178
Specify generic constraints added to support nullable reference types in C# 8 #1178
Conversation
@jskeet I added the meeting discuss label on this. I doubt that it's final, but it's worth a first look. |
(I'll wait for responses to @KalleOlaviNiemitalo's questions before reviewing, if that's okay.) |
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.
Some comments plus ANTLRizing some grammar rules.
I haven’t considered per se what should (not) be in the Standard in regards to the specification of NRT.
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.
I like Nigel's suggestions in general. My guess is that the currently-unused rules are intended to be used in the future? Would be good to know.
Which rules do you think are unused? I didn't see any. |
|
Got it. I'd missed some edits. See latest commit. |
Example discussed in the meeting:
|
Bring in the normative text from dotnet#700. Some text is removed because of the decision on normative language in our September meeting.
Co-authored-by: Nigel-Ecma <[email protected]>
b8b3545
to
9536d97
Compare
@BillWagner Is this ready for another round of review? |
@jskeet Edits made and pushed this morning (my time). It's ready for review. |
Co-authored-by: Nigel-Ecma <[email protected]>
Co-authored-by: Nigel-Ecma <[email protected]>
We'd used `'?'` and `nullable_type_attribute` in different places for the `?` annotation. Define `nullable_type_attribute` at first use, and use that consistently.
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.
Just one comment for now. I need to have another look when more awake...
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.
I think I'm starting to get my head round this again...
Co-authored-by: Jon Skeet <[email protected]>
Offline comment from @Nigel-Ecma
As noted by Neal, this is an error: public partial class PartialList : List<string>
{
}
public partial class PartialList : List<string?>
{
} Error: CS0263 Partial declarations of 'PartialList' must not specify different base classes |
Discussions:
|
We observe that Roslyn allows both of these: public class Foo<T> where T : notnull, Stream
public class Foo<T> where T : notnull, Stream? This PR prohibits both. @BillWagner will file a bug against Roslyn (which we suspect will be closed). |
@BillWagner – I made some changes in PR #1195 thinking this PR was already merged, oops. I've removed them from 1195 but cannot make direct suggestions here as the changes are on lines this PR has not modified. SO here they are as text blocks. The changes centred around changing In types.md §8.9.1, first para, line 729 there are a couple of
I made a few other word changes, e.g. can -> may. I do think this para needs some work on its clarity, but I’ve no suggestions right now – and that can come in a subsequent PR as its nothing to do with this one per se. For line 738 I suggest:
On line 746 there is another There might be other (Note: There is a simple typo on line 728, I’ve added PR #1199 to fix it.) Before I removed the changes from #1195 @KalleOlaviNiemitalo raised a comment on the naming of nullable_type_attribute – I've asked them to make the comment in this PR. |
This covers part 1, the comments in the files tab
This commit addresses the comments in the conversation tab from the 10/30 meeting.
This commit incorporates the comments on the conversation tab.
Co-authored-by: Nigel-Ecma <[email protected]>
with nullable_type_annotation
Add the
class?
andnotnull
constraint.The
default
constraint is added in C# 9, so is not included.