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

Invalid case for conditional_binding_cascade #667

Closed
zetasq opened this issue May 16, 2016 · 4 comments
Closed

Invalid case for conditional_binding_cascade #667

zetasq opened this issue May 16, 2016 · 4 comments
Labels

Comments

@zetasq
Copy link

zetasq commented May 16, 2016

My code is like below:

if case .Success(let info) = response.result, let jsonDic = info as? [String: AnyObject]

I can't remove the second "let" to fix this warning. The implementation of conditional_binding_cascade should be improved to remove this bug.

@lessthanyouthink
Copy link

I found a related invalid case when using enums with multiple associated values. For example:

if case .Response(response: let r, json: let j) = result

@jpsim
Copy link
Collaborator

jpsim commented May 16, 2016

that second one will be really tricky to fix @lessthanyouthink

@zwaldowski
Copy link

A few other false positives, if it helps:

guard case let .NetworkError(anotherError) = error, let nsUrlError = anotherError as? NSURLError else {
if case let .RunningPath(parentPath) = state, let restorationIdentifier = vc.restorationIdentifier
if case (let oldType, var indexPaths)? = inFlightItemTransactions where oldType == type
guard let sself = self, case .Success(let data) = imageResult else { return }

@paddlefish
Copy link

Fixed in #673 . Actually it just bails when case is involved since it appears to be pretty hard to determine when let is in a case vs when it's in the expression. (At least I couldn't find a way to glean that from the current info that the code analysis dictionary had.)

@jpsim jpsim closed this as completed May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants