-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix trim analyzer warning for inferred type arguments #87156
Conversation
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas Issue DetailsFixes #86032. This replaces the syntax-based logic with:
The syntax-based logic used to also warn for the types of local variables, but I'm slightly concerned that this could be missing some cases, but at least it works on our existing testcases. There are two slight differences in warning locations, which I don't expect to cause issues for warning suppressions:
|
src/tools/illink/src/ILLink.RoslynAnalyzer/DynamicallyAccessedMembersAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/src/ILLink.RoslynAnalyzer/DynamicallyAccessedMembersAnalyzer.cs
Show resolved
Hide resolved
src/tools/illink/src/ILLink.RoslynAnalyzer/DynamicallyAccessedMembersAnalyzer.cs
Outdated
Show resolved
Hide 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.
In general looks good.
src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresAccessedThrough.cs
Outdated
Show resolved
Hide resolved
- Allow illink to match ExpectedWarning on property against a warning produced from getter - Add back NativeAOT_StorageSpaceType for illink warning - Add comment about analyzer local variable behavior
Fixes #86032.
This replaces the syntax-based logic with:
The syntax-based logic used to also warn for the types of local variables, but
SymbolKind.Local
isn't supported forRegisterSymbolAction
. Since this falls into the category of warnings that isn't strictly necessary (based on nativeaot logic which only warns on generic instantiations that can actually lead to code execution), I just left out local variables.I'm slightly concerned that this could be missing some cases, but at least it works on our existing testcases.
There are two slight differences in warning locations, which I don't expect to cause issues for warning suppressions:
RequireMethods<TFields> Property => null
), the ISymbol-based approach warns on the underlying getter method, whose location seems to be the body of the accessor. We used to warn on the return type specifically, but I couldn't find a better way to get the location.