Skip to content

Improve diagnosis of the missing expression in a for-each loop #1683

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

Merged
merged 1 commit into from
May 22, 2023

Conversation

TTOzzi
Copy link
Member

@TTOzzi TTOzzi commented May 21, 2023

Resolve #1602

The expectedSequenceExpressionInForEachLoop diagnostic message did not have FixIts.
I have added an appropriate FixIt and modified the related test case 🙂

@TTOzzi TTOzzi requested a review from ahoppen as a code owner May 21, 2023 03:03
@@ -778,7 +778,17 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
)
Copy link
Member Author

@TTOzzi TTOzzi May 21, 2023

Choose a reason for hiding this comment

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

I also discovered issues with the C-style for loop, but it seemed difficult to resolve them simply 🤯
(testRecovery31?, testRecovery32, testRecovery33, testRecovery38)
It appears that they should be considered as separate issues.

Copy link
Member

Choose a reason for hiding this comment

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

Honestly, I just don’t care about the C-style for loop diagnostic. If you write C-style for loops in Swift. That diagnostic dates back in the old parser from the Swift 1 days when people were migrating from (Objective-)C to Swift and maybe didn’t know how to write Swift-style for loops and I only migrated it to the new parser as a proof-of-concept of a slightly more involved diagnostic.

@kimdv
Copy link
Contributor

kimdv commented May 21, 2023

@swift-ci please test

@kimdv
Copy link
Contributor

kimdv commented May 22, 2023

@swift-ci please test macOS

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Nice catch

@ahoppen ahoppen merged commit d3ce991 into swiftlang:main May 22, 2023
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.

Missing <#expression#> in for-each loop
3 participants