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

Simplify DAM analyzer and add conversion test - #2297

Merged
sbomer merged 3 commits into
dotnet:feature/damAnalyzerfrom
sbomer:conversionTest
Sep 29, 2021
Merged

sbomer merged 3 commits into
dotnet:feature/damAnalyzerfrom
sbomer:conversionTest

Conversation

@sbomer

@sbomer sbomer commented Sep 28, 2021

Copy link
Copy Markdown
Member

@mateoatr I was looking again at the analyzer and saw some opportunity to simplify. I didn't understand why we check for Conversion operations specifically at https://github.com/dotnet/linker/blob/feature/damAnalyzer/src/ILLink.RoslynAnalyzer/DynamicallyAccessedMembersAnalyzer.cs#L125
so I wrote a test that should show a case where we might want different behavior for a conversion operator.

For now this pipes the targetIsMethodReturn argument through a few helpers, but soon we should be able to get rid of it and have a uniform representation of the source/target values.

}

[Fact]
public Task ConversionOperation ()

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.

Shouldn't this be in the shared tests?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It should be, but I think there's still a little work left for us to confidently share tests, so I've put it here for now. I don't think it hurts to have a few analyzer-only tests as a sanity check, as long as we go back and make sure the shared tests have full coverage later.

- Take Location in helper instead of originOperation
- Avoid optional parameters
- Add test with DAM on conversion return type

@mateoatr mateoatr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Much cleaner/clearer! Thanks!

@agocke agocke 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.

LGTM

@agocke

agocke commented Sep 29, 2021

Copy link
Copy Markdown
Member

If there's still outstanding work for the test integration it would be good to have an issue to track that

@sbomer

sbomer commented Sep 29, 2021

Copy link
Copy Markdown
Member Author

Tracking issue for test integration: #2299 (some of it moved out from #2273)

@sbomer
sbomer merged commit 8e7b310 into dotnet:feature/damAnalyzer Sep 29, 2021
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
* Simplify DAM analyzer and add conversion test

* PR feedback
- Take Location in helper instead of originOperation
- Avoid optional parameters
- Add test with DAM on conversion return type

* Add success testcase

Commit migrated from dotnet/linker@8e7b310
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