Skip to content

[lib/Parse] #58741 Do not suggest moving any or some to the beginning of a compositi… #58742

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

Conversation

moritzdietsche
Copy link
Contributor

@moritzdietsche moritzdietsche commented May 8, 2022

…on if the first type is already an existential or opaque type.

When some or any appear within a composition instead of at the beginning, the compiler suggests moving the keyword to the beginning. If either of the keywords already appear at the beginning of the composition, the code after the application of the fix-it will be syntactically incorrect.

This change checks if some or any are already specified at the beginning of the composition and, if yes, simply suggests to remove the occurrence within the composition instead of moving it to the beginning

Resolves #58741.

@LucianoPAlmeida
Copy link
Contributor

@swift-ci Please smoke test

@LucianoPAlmeida LucianoPAlmeida requested a review from hborla May 8, 2022 14:33
Copy link
Member

@hborla hborla left a comment

Choose a reason for hiding this comment

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

Sorry for the late review, looks great to me!

@hborla
Copy link
Member

hborla commented May 25, 2022

@swift-ci please smoke test

@LucianoPAlmeida
Copy link
Contributor

@LucianoPAlmeida LucianoPAlmeida merged commit 0eafd08 into swiftlang:main May 26, 2022
@hborla
Copy link
Member

hborla commented May 26, 2022

@LucianoPAlmeida @moritzdietsche are either of you interested in cherry-picking this to the release/5.7 branch?

@LucianoPAlmeida
Copy link
Contributor

Sure, I can do it real quick =]

@LucianoPAlmeida
Copy link
Contributor

Done :)

@moritzdietsche moritzdietsche deleted the fix-it-for-repeated-any-or-some-in-composition branch May 26, 2022 04:13
@moritzdietsche moritzdietsche restored the fix-it-for-repeated-any-or-some-in-composition branch May 26, 2022 04:14
@moritzdietsche moritzdietsche deleted the fix-it-for-repeated-any-or-some-in-composition branch May 26, 2022 04:15
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.

Fix-it for repeated any and some in composition results in incorrect code
3 participants