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

Fix delegate conversion on analyzers #1964

Merged
merged 4 commits into from
Apr 24, 2021

Conversation

tlakollo
Copy link
Contributor

Fix delegate conversion on analyzers
Add tests
Related to #1912

@tlakollo tlakollo self-assigned this Apr 15, 2021
@@ -72,6 +72,12 @@ public override void Initialize (AnalysisContext context)
CheckMethodOrCtorCall (operationContext, prop.SetMethod);
}, OperationKind.PropertyReference);

context.RegisterOperationAction (operationContext => {
Copy link
Member

Choose a reason for hiding this comment

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

This diff makes me think we need to share more between the two analyzers. They look like they're doing pretty much exactly the stuff.

@@ -352,5 +352,52 @@ public void M()

return VerifyRequiresAssemblyFilesAnalyzer (src);
}

[Fact]
Copy link
Member

Choose a reason for hiding this comment

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

Same with the tests. Can we start to share stuff here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I open #1986 to track the refactoring work in a separate PR since I think it would have a lot of feedback.

Fix test
Add number of iterations to codefix
@tlakollo tlakollo requested a review from agocke April 22, 2021 00:24
Copy link
Member

@agocke agocke left a comment

Choose a reason for hiding this comment

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

LGTM aside from small question about comment

@tlakollo tlakollo merged commit 7ddfe7b into dotnet:main Apr 24, 2021
@tlakollo tlakollo deleted the FixAnalyzerDelegateConversion branch April 24, 2021 01:07
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
Fix delegate conversion on analyzers
Fix test in RequiresUnreferencedCodeAnalyzer
Add tests for delegate conversion
Add the ability to pass the number of iterations in a codefix

Commit migrated from dotnet/linker@7ddfe7b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants