Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Produce warnings for annotations on invalid types - #2599

Merged
tlakollo merged 4 commits into
dotnet:feature/damAnalyzerfrom
tlakollo:AnnotationsOnInvalidTypes
Feb 14, 2022
Merged

tlakollo merged 4 commits into
dotnet:feature/damAnalyzerfrom
tlakollo:AnnotationsOnInvalidTypes

Conversation

@tlakollo

@tlakollo tlakollo commented Feb 11, 2022 •

Copy link
Copy Markdown
Contributor

Produce warnings for annotations on invalid types using a symbol analyzer
Don't produce dataflow warnings for annotations on invalid types
Add extension file to ask if a type is interesting for dataflow

Fixes #2598

…yzer

Dont produce dataflow warnings for annotations on invalid types
Add extension file to ask if a type is interesting for dataflow
@tlakollo tlakollo self-assigned this Feb 11, 2022
@tlakollo

Copy link
Copy Markdown
Contributor Author

They are two tests failing, one of them at least to me seems like it should be a warning since the property type is object. But linker does dataflow analysis and ends up generating another warning. Second one seems to be related to an intrinsic, it believes is operating over a TypeHandle but we are using Type.GetTypeFromHandle() so its actually operating on a type. Will have to go deeper on those failures

@tlakollo
tlakollo marked this pull request as ready for review February 11, 2022 23:28
(calledMethod.ReturnType.IsTypeInterestingForDataflow () ||
(calledMethod.AssociatedSymbol is IPropertySymbol property &&
property.Type.IsTypeInterestingForDataflow ()))) {
methodReturnValue = new MethodReturnValue (calledMethod);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this needs to handle the associated symbol specially, because MethodReturnValue already checks FlowAnnotations.GetMethodReturnValueAnnotation which looks at the associated symbol.

We also should do the same in HandleReturnValue and VisitConversion.

@vitek-karas vitek-karas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good.

@tlakollo
tlakollo merged commit 09bef6e into dotnet:feature/damAnalyzer Feb 14, 2022
@tlakollo
tlakollo deleted the AnnotationsOnInvalidTypes branch February 14, 2022 21:06
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
Produce warnings for annotations on invalid types using a symbol analyzer
Add code to not produce invalid types warnings on dataflow analysis, and reduce the scope to only interesting types
Add extension file to ask if a type is interesting for dataflow

Commit migrated from dotnet/linker@09bef6e
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants