-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Track unknown value as result of unimplemented operations #101752
Conversation
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas |
return constValue; | ||
|
||
if (operation.Type is not null) |
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.
What does it mean when it's null vs nonnull? A comment here might be helpful if it's not in the doc comments for IOperation.Type.
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.
Null just means it doesn't produce a result: https://learn.microsoft.com/dotnet/api/microsoft.codeanalysis.ioperation.type?view=roslyn-dotnet-4.7.0#microsoft-codeanalysis-ioperation-type
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.
Looks good to me, thank you!
) Up until now, the analyzer has been set up to return `TopValue` for operations which are not handled by their own `Visit` overrides, to avoid producing warnings that are not produced from ILLink or ILC. This changes the default handling to return `UnknownValue.Instance`, so that such operations produce warnings if the return value flows into a location with dataflow requirements. Fixes dotnet#101733, where the return value of a string interpolation operation (which doesn't have special handling in a `Visit` override) was not producing warnings when passed to `Type.GetType`.
) Up until now, the analyzer has been set up to return `TopValue` for operations which are not handled by their own `Visit` overrides, to avoid producing warnings that are not produced from ILLink or ILC. This changes the default handling to return `UnknownValue.Instance`, so that such operations produce warnings if the return value flows into a location with dataflow requirements. Fixes dotnet#101733, where the return value of a string interpolation operation (which doesn't have special handling in a `Visit` override) was not producing warnings when passed to `Type.GetType`.
Up until now, the analyzer has been set up to return
TopValue
for operations which are not handled by their ownVisit
overrides, to avoid producing warnings that are not produced from ILLink or ILC. This changes the default handling to returnUnknownValue.Instance
, so that such operations produce warnings if the return value flows into a location with dataflow requirements.Fixes #101733, where the return value of a string interpolation operation (which doesn't have special handling in a
Visit
override) was not producing warnings when passed toType.GetType
.