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

IDE0028: Added simplifying collection initializer in tuple #72332

Conversation

victor-pogor
Copy link
Contributor

fixes #72169

collection-expression.mp4

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 29, 2024
@victor-pogor victor-pogor force-pushed the 72169-use-collection-expression-in-valuetuple branch from 855d9b1 to 363d730 Compare February 29, 2024 13:43
@victor-pogor victor-pogor marked this pull request as ready for review February 29, 2024 13:46
@victor-pogor victor-pogor requested a review from a team as a code owner February 29, 2024 13:46
if (newExpression.IsKind(SyntaxKind.TupleExpression) &&
this.SpeculativeSemanticModel.GetConversion(newExpression).IsTupleLiteralConversion)
{
return true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there any extra condition needed here? Like:

SymbolsAreCompatible(originalTypeInfo.Type, newTypeInfo.ConvertedType)

I see the tests are working too if having this extra condition

Copy link
Member

Choose a reason for hiding this comment

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

Yes. The types should be validated as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@victor-pogor
Copy link
Contributor Author

Hi @CyrusNajmabadi, could you review this PR please 🌝

@CyrusNajmabadi
Copy link
Member

Thanks!

@CyrusNajmabadi CyrusNajmabadi merged commit 46be15d into dotnet:main Mar 27, 2024
25 of 27 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Mar 27, 2024
@victor-pogor victor-pogor deleted the 72169-use-collection-expression-in-valuetuple branch April 1, 2024 08:35
@dibarbet dibarbet modified the milestones: Next, 17.11 P1 Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE 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.

Missing opportunity for a collection expression in a value tuple
3 participants