-
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
Ensure that IOperations nodes within a C# local function are part of … #19906
Conversation
…the operation tree Analysis of any code within a local function with IOperation analyzers will produce false or missing diagnostics, as the operation tree doesn't contain any operation nodes within the BoundLocalFunctionStatement. This can be a dogfood blocker for IOperation analyzers on real world code - we had few false reports due this on the Roslyn repo as we use this new language feature, and corresponding rules had to be disabled in the repo.
Tagging @dotnet/analyzer-ioperation @AlekseyTs @cston @jcouv for review. Note the unshipped public API for VisitLocalFunctionStatement was not correct - it operation on an IOperation node, instead of a specific type of IOperation API for local functions. I have removed this for 15.3 and we can add it back in 15.later when we have designed IOperation API for local functions. |
@mavasani you're referencing a PR not an Issue. |
@CyrusNajmabadi corrected with issueid |
Test failure due to |
@dotnet-bot retest windows_coreclr_test_prtest please |
Ping.. |
Can someone from @dotnet/roslyn-compiler take a look as well? Tagging @MattGertz for approval. |
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
Please follow the policy of two sign-offs from @dotnet/roslyn-compiler . |
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
…the operation tree
Customer scenario
Analysis of any code within a local function with IOperation analyzers will produce false or missing diagnostics, as the operation tree doesn't contain any operation nodes within the BoundLocalFunctionStatement. This can be a dogfood blocker for IOperation analyzers on real world code - we had few false reports due this on the Roslyn repo as we use this new language feature, and corresponding rules had to be disabled in the repo.
Bugs this fixes:
Workaround for #19902
Workarounds, if any
Disable or uninstall IOperation based analyzers
Risk
Low risk. We are following the common pattern for not yet implemented IOperation feature API for 15.3 - we don't yet provide rich IOperation API for the new language feature, but ensure that any descendant operation nodes are still included in the Operation tree.
Performance impact
None
Is this a regression from a previous update?
No, this never worked before.
Root cause analysis:
We missed this while adding unit tests because BoundLocalFunctionStatement actually returns OperationKind.LocalFunctionStatement, but there is no corresponding IOperation API for local functions.
How was the bug found?
Dogfooding.