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

Initial support for a set of analyzers/fixers to update existing code to use collection expressions. #69118

Merged
merged 30 commits into from
Jul 26, 2023

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Jul 19, 2023

Part of the work for: #69132

So i'm breaking things into pieces to make it easier to review.

This PR is specifically about handling new X[] { a, b, c } or new[] { a, b, c } or X[] v = { a, b, c } and offering to convert to [a, b, c] in those cases.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner July 19, 2023 23:21
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 19, 2023
@sharwell sharwell added the Story label Jul 20, 2023
});
}

private static bool IsInTargetTypedLocation(SemanticModel semanticModel, ExpressionSyntax expression, CancellationToken cancellationToken)
Copy link
Member

Choose a reason for hiding this comment

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

Will this suffer from many semantic model calls? I think the syntactic filteration would still have many applicable nodes, and hence many semantic model calls.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure what thsi question means.

Copy link
Member

Choose a reason for hiding this comment

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

I mean, does this make too many semantic model caĺls that could affect performance?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see anything that would cause too many semantic model calls here. We effectively are doing a check right on the item of interest.

@CyrusNajmabadi
Copy link
Member Author

Example of results here: #69189

@CyrusNajmabadi
Copy link
Member Author

@dotnet/roslyn-ide ptal :)

@CyrusNajmabadi
Copy link
Member Author

@akhera99 @genlu @Cosifne ptal.

@CyrusNajmabadi
Copy link
Member Author

@dotnet/roslyn-ide ptal.

}

[Fact]
public async Task TestTargetTypedInConditional4()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public async Task TestTargetTypedInConditional4()
public async Task TestTargetTypedMissingInConditional4()

Copy link
Member Author

Choose a reason for hiding this comment

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

sure. can update that name in followup :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Analyzers Story untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants