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-11773] UseLetInEveryBoundCaseVariable has false positives #342

Closed
swift-ci opened this issue Nov 13, 2019 · 6 comments
Closed

[SR-11773] UseLetInEveryBoundCaseVariable has false positives #342

swift-ci opened this issue Nov 13, 2019 · 6 comments
Assignees
Labels
bug Something isn't working swift-format

Comments

@swift-ci
Copy link

Previous ID SR-11773
Radar rdar://problem/57242761
Original Reporter SDGGiesbrecht (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s swift-format
Labels Bug
Assignee @allevato
Priority Medium

md5: a2489a4b198fde114394d4d46b74703d

Issue Description:

case let simple as SimpleTypeIdentifierSyntax:

distribute 'let' to each bound case variable

@beccadax
Copy link

@swift-ci create

@eeckstein
Copy link
Member

SDGGiesbrecht (JIRA User) Can you please specify in more detail what's the problem here? Can you attach a self-containing test case?

@swift-ci
Copy link
Author

Comment by Jeremy David Giesbrecht (JIRA)

I copied and pasted it from the forums here. The formatting is less readable here, but the line above in code voice was the trigger and the quotation was the error. There is more context in the forum if you end up needing it.

@akyrtzi
Copy link
Member

akyrtzi commented Nov 15, 2019

\cc @allevato

@allevato
Copy link
Collaborator

This rule is supposed to be catching situations like case let .label(foo, bar) (to prefer case .label(let foo, let bar)), but the implementation is far too simple: it only checks to see if the case's pattern is a ValueBindingPatternSyntax, which also includes patterns like let x as T.

We need to drill further down into the pattern to distinguish these.

@allevato
Copy link
Collaborator

Fixed by #244.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working swift-format
Projects
None yet
Development

No branches or pull requests

5 participants