-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Adjust nullability analysis for extension operators. #79103
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
Adjust nullability analysis for extension operators. #79103
Conversation
Related to dotnet#29605. Related to dotnet#29961. Related to dotnet#79011.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
jcouv
left a comment
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 (commit 1)
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
I think the behavior is intentional and desirable. In reply to: 2998670074 Refers to: src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionOperatorsTests.cs:14916 in b279a80. [](commit_id = b279a80, deletion_comment = False) |
Because the scenarios are related to the issue and they were not working properly before my changes. I also modified the code in the function from the issue. In reply to: 2998710883 Refers to: src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionOperatorsTests.cs:8068 in b279a80. [](commit_id = b279a80, deletion_comment = False) |
Added a targeted test - Binary_128_NullableAnalysis_Logical_Chained
Perhaps it would be good to have some tests for completeness sake, but, since we are not changing the shape of the bound tree and not introducing new syntax for consumption, I do not find these scenarios particularly interesting or high priority. Making a note for test plan
Added a targeted nullability test with a lambda. Making a note for test plan.
Conditional nature of the assignment doesn't affect how compound assignment operation In reply to: 2998703574 Refers to: src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionOperatorsTests.cs:16074 in b279a80. [](commit_id = b279a80, deletion_comment = False) |
Related to dotnet#35031.
Will raise the question in WG to confirm In reply to: 3000409835 Refers to: src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionOperatorsTests.cs:14916 in b279a80. [](commit_id = b279a80, deletion_comment = False) |
jcouv
left a comment
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 (commit 3)
|
@RikkiGibson, @jjonescz, @dotnet/roslyn-compiler For a second review. |
|
|
||
| public override BoundNode? VisitCompoundAssignmentOperator(BoundCompoundAssignmentOperator node) | ||
| { | ||
| ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt = GetUpdatedArray(node, node.OriginalUserDefinedOperatorsOpt); |
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 looks like originalUserDefinedOperatorsOpt is not used. Was that intentional? #Resolved
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 looks like
originalUserDefinedOperatorsOptis not used. Was that intentional?
Looks like a bug in NullabilityRewriter code generator. The function was moved from generated code and adjusted to fix up node.Operator. I'll fix this part too.
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.
Opened #79132 for the generator
|
@RikkiGibson, @jjonescz, @dotnet/roslyn-compiler For a second review. |
| { | ||
| if (node.LeftConversion is BoundConversion leftConversion) | ||
| if (node.LeftConversion is BoundConversion leftConversion && | ||
| !(node.Operator.Method is { IsStatic: false } method && method.GetIsNewExtensionMember())) |
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.
Why are we skipping verification in this case? #Resolved
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.
Why are we skipping verification in this case?
Because we know we do not visit the node in a normal fashion. The rewrite is done for the benefit of type information from SemanticModel and it doesn't depend on LeftConversion member anyway.
|
@RikkiGibson I merged the PR in order to expedite code flow since the PR met the two sign-offs requirement. If you have additional feedback, I will follow up on it separately. |
Related to #29605.
Related to #29961.
Related to #79011.
Related to #35031.
Relates to test plan #76130