-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add nullable annotations to NullableWalker #45640
Conversation
Test failures likely due to #44348 #Resolved |
Why is this safe? I think we should prefer an assert over suppression if we're certain. #Closed Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:754 in d55f42e. [](commit_id = d55f42e, deletion_comment = False) |
src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.SnapshotManager.cs
Show resolved
Hide resolved
We could break this out into something like Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:2647 in d55f42e. [](commit_id = d55f42e, deletion_comment = False) |
Ah, nevermind, this is from the inlining of the helper. In reply to: 656781489 [](ancestors = 656781489) Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:2944 in d55f42e. [](commit_id = d55f42e, deletion_comment = False) |
What's the suppressions in this method, I thought it was being skipped? #Closed Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:6142 in d55f42e. [](commit_id = d55f42e, deletion_comment = False) |
Could make this a pattern and get rid of the suppression: Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:7277 in d55f42e. [](commit_id = d55f42e, deletion_comment = False) |
I don't think the above assert actually guarantees that Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:8287 in d55f42e. [](commit_id = d55f42e, deletion_comment = False) |
@@ -271,9 +271,9 @@ protected virtual int MakeSlot(BoundExpression node) | |||
case BoundKind.FieldAccess: | |||
case BoundKind.EventAccess: | |||
case BoundKind.PropertyAccess: | |||
if (TryGetReceiverAndMember(node, out BoundExpression receiver, out Symbol member)) | |||
if (TryGetReceiverAndMember(node, out BoundExpression? receiver, out Symbol? member)) |
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.
member [](start = 97, length = 6)
Can we add an attribute? #Closed
Done review pass (commit 2) #Closed |
All callers that pass non-null for In reply to: 656423032 [](ancestors = 656423032) Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:1003 in d55f42e. [](commit_id = d55f42e, deletion_comment = False) |
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.
Done with review pass (iteration 8)
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.
LGTM Thanks (iteration 15)
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.
LGTM (commit 15). One more small comment on a possible use of NotNullWhen
to remove some suppressions, but otherwise looks good.
var method = _symbol as MethodSymbol; | ||
if (method is object) |
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.
var method = _symbol as MethodSymbol; | |
if (method is object) | |
if (_symbol is MethodSymbol method) | |
``` #ByDesign |
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.
That was the syntax before this change. Unfortunately, that does not allow an annotation on method
. (if (_symbol is MethodSymbol? method)
is not valid syntax.)
In reply to: 463853593 [](ancestors = 463853593)
All methods are annotated except
VisitConversion()
.