-
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
Properly detect root of a tree in Operation.SearchParentOperation #22974
Conversation
@dotnet/roslyn-compiler, @dotnet/analyzer-ioperation, @heejaechang, @cston Please review 15.5 IOperation fix. |
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.
@@ -286,6 +285,12 @@ internal IOperation SearchParentOperation() | |||
} | |||
} | |||
|
|||
if (SemanticModel.Root == currentCandidate) |
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 believe you could avoid duplicating this check by doing it at the beginning of the loop and setting currentCandidate
to Syntax
at the beginning of the loop.
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 believe you could avoid duplicating this check by doing it at the beginning of the loop and setting currentCandidate to Syntax at the beginning of the loop.
Then the loop would have to be changed to ```while (true) and the null check moved inside. I believe the condition is simple enough that duplication is not an issue.
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
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
Pre-Approved to merge via Link |
* dotnet/master: (36 commits) Remove usage of IOperation feature flag in newly added unit tests More fixes for IOperation tree. (dotnet#23028) Address PR feedback and remove unused resource and comment out unused error code Remove IOperation feature flag and internal registration APIs for operations Add unit test for VB Address review feedback and add more unit tests Fix unit tests Fix build errors from merge resolution Revert unintentional newline deletion Address recent feedback and do not generate an IParenthesizedOperation for C#. This change is now just a test-only change that verifies the current behavior. Address PR feedback and use singleton for null instance Address PR feedback Address PR feedback Do not invoke GetStandaloneNode helper in GetOperationWorker Fix InvalidCastException in CSharpOperationFactory for invalid nested member initializer (dotnet#22983) Use ICollection<string>.Contains to avoid Enumerator allocation Add IsRef property to IConditionalOperation and ISimpleAssignmentOperation, add RefKind property to ILocalSymbol. (dotnet#22933) Enable peverify-compat mode for langver < 7.2 (dotnet#22772) Properly detect root of a tree in Operation.SearchParentOperation (dotnet#22974) Fix IArgument and IArrayInitializer to have null types ...
Fixes #22964
vso :https://devdiv.visualstudio.com/DevDiv/NET%20Developer%20Experience%20Productivity/_workitems/edit/518796