Skip to content

[Diagnostics] Improve warning suggestion for var in for loop #76946

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
Dec 11, 2024

Conversation

pwongxy
Copy link
Contributor

@pwongxy pwongxy commented Oct 10, 2024

When iterator consists of tuple of variable and iteration only mutates the tuple partially, improve the warning message from "changing to 'let" to "changing to 'case let'"

Resolves #72811

@pwongxy pwongxy force-pushed the diag-warn-on-for-var-loop branch from 7fdc849 to 7e2b220 Compare October 27, 2024 12:59
@xedin xedin self-requested a review October 27, 2024 15:47
@pwongxy pwongxy force-pushed the diag-warn-on-for-var-loop branch from 7e2b220 to 70e7c3c Compare November 5, 2024 07:57
When iterator consists of tuple of variable and iteration only mutates
the tuple partially, improve the warning message from "changing to 'let"
to "changing the pattern to '(..., case let, ...)"
@pwongxy pwongxy force-pushed the diag-warn-on-for-var-loop branch from 70e7c3c to c1473e8 Compare December 10, 2024 14:51
@xedin
Copy link
Contributor

xedin commented Dec 10, 2024

@swift-ci please test

@xedin xedin merged commit 93a8675 into swiftlang:main Dec 11, 2024
5 checks passed
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.

Variable i was never mutated in .enumerated() for var loop; needs fix-it to suggest for case (let _, var _)
2 participants