Skip to content
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

Merged
merged 3 commits into from
May 1, 2024

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Apr 30, 2024

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 #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.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Apr 30, 2024
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Apr 30, 2024
Copy link
Contributor

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

@sbomer sbomer changed the title Interpolated string fix Track unknown value as result of unimplemented operations Apr 30, 2024
@sbomer sbomer requested a review from jtschuster April 30, 2024 23:27
return constValue;

if (operation.Type is not null)
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@jtschuster jtschuster left a 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!

@sbomer sbomer merged commit 5d05361 into dotnet:main May 1, 2024
74 of 77 checks passed
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
)

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`.
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
)

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`.
@github-actions github-actions bot locked and limited conversation to collaborators Jun 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ILLink analyzer doesn't warn for unknown interpolated string
2 participants