Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
React to latest Roslyn nullability changes #36104
React to latest Roslyn nullability changes #36104
Changes from 1 commit
a8446cb
73003ac
9a70a2b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Open question: I'm not sure if this assertion is actually correct. Is it possible to have - say -
BlockingCollection<string?>
? If that's legal, we should remove this assert.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.
Yes, that's valid. Please revert the added code. It's a little disheartening this didn't cause any existing tests to fail. Sigh.
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'll remove the assertion and add an explicit unit test.
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.
There's no way to suppress this warning with a well-placed
!
somewhere? The clutter caused by!
is bad enough, but adding a bunch of pragmas to suppress false positive nullable warnings just makes me sad.cc: @jcouv
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.
It's still not great, but possibly a bit better: add a
return true;
below theDebug.Assert(item != null);
at line 761.From the language/compiler perspective, it may be useful to allow
return waitForSemaphoreWasSuccessful!;
to solve this.In reply to: 422141700 [](ancestors = 422141700)
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.
@jcouv, yeah, let's do that 😄
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 did consider using the
if (condition) { assert(); return true; } else { return false; }
pattern, but it produces different IL and codegen than a simplereturn condition;
. I tried to avoid making changes that affected the codegen in any way.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.
Argh, I missed that the
Debug.Assert(item != null)
doesn't work here. An alternative would be_ = item!;
to pretend that it's not null, but that smells in this case, and also that's not yet implemented.I'll push on allowing suppression on
return someBoolValue!;
.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.
Another option (also smells) is to suppress on places that assign to
item
(pretend like we're never assigning maybe-null values)In reply to: 422242826 [](ancestors = 422242826)
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.
Yeah, using the ! operator inappropriately early in the method strikes me as undesirable. I'll leave the pragma for now and add a code comment directing to #36132. Once the language team settles on guidance for this we can react to it here.
Much appreciate your responsiveness on this! :)