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

[SR-226] Implement warning about the use of C-style for loops in Swift 2.2 #42848

DougGregor opened this issue Dec 14, 2015 · 3 comments
compiler The Swift compiler itself task


Copy link

Previous ID SR-226
Radar None
Original Reporter @DougGregor
Type Task
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Task
Assignee @gregomni
Priority Medium

md5: 059d6db82e39ab1b799b6c27509640a5

Issue Description:


we should implement a warning in Swift 2.2 that informs users that C-style for loops are going away.

Copy link
Member Author

Bonus points for recognizing idiomatic C-style for loops that could trivially be rewritten as for-in loops and providing a Fix-It to help with migration. For example:

for var x = 0; x != n; ++x { ... }

could be migrated to:

for x in 0..n { ... }

when x isn't written to.

Copy link

I've been doing some diagnoses fixing recently and getting somewhat familiar with this area. Would be happy to take this on, if no one else has code in the works.

Copy link

Still need to clean up the fix it ranges, but here's most of it: <\>.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
compiler The Swift compiler itself task
None yet

No branches or pull requests

2 participants