You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You didn't put a label in your pattern-match: case .NonFatalError(messages: let messages). This should probably complain about being ambiguous, though. cc CodaFi (JIRA User)
@belkadan I ran into the same issue today. Your suggestion throws another unrelated error. In addition to that, a non-exhaustive warning is not shown for the switch.
importUIKitenumResult {
casefinished(error: Error)
casefinished(response: String)
}
vara: Result = .finished(response: "A")
switcha {
case .finished(letresponse): // type is stringprint(response)
// missing warning for non exhaustive switch
}
switcha {
case .finished(response: letresponse):
print(response)
case .finished(error: leterror): // error: tuple pattern element label 'error' must be 'response'print(error)
}
Environment
Swift 4.1 Playground in Xcode 10.0 (10A254a) on macOS 10.14 (18A391)
Additional Detail from JIRA
md5: bea00aad8d9891b0317e78ea34c47706
Parent-Task:
Issue Description:
When overloading enum cases with labelled associated values, pattern matching only works for the last case defined with the same base name.
Minimal test-case:
Only the second pattern matches.
When I reverse the order of the two NonFatalError cases, only the first if-case matches.
Expected behaviour: either the enum should not compile, or the pattern matching should work.
The text was updated successfully, but these errors were encountered: