We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Apple Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift 1f2908b) Target: x86_64-apple-macosx10.9
md5: 46b2753712c7c2ea13b96fc0d7a94fb7
is duplicated by:
relates to:
Issue Description:
The compiler fails to see that this is an exhaustive switch statement:
enum MyEnum { case A, B } let (e, f) = (MyEnum.A, MyEnum.B) switch (e, f) { case (_, .B) : break case (.B, _) : break case (.A, .A): break }
It accepts the following as exhaustive, but fails to warn that the last case will never be executed:
switch (e, f) { case (_, .B) : break case (.B, _) : break case (.A, .A): break case (.A, .B): break }
It does not accept the following as exhaustive (same as the one above, except (.A, .A) is now the first case):
switch (e, f) { case (.A, .A): break case (_, .B) : break case (.B, _) : break case (.A, .B): break }
The text was updated successfully, but these errors were encountered:
Comment by Kelan Champagne (JIRA)
I ran into this too. This is a slightly more distilled variation of the example above.
Starting from the same:
enum MyEnum { case A, B } let (e, f) = (MyEnum.A, MyEnum.B)
This says error: switch must be exhaustive:
error: switch must be exhaustive
switch (e, f) { case (.A, .A): break case (.A, .B): break case (.B, _): break }
But, if you move that wildcard case to the top, then it works:
switch (e, f) { case (.B, _): break case (.A, .A): break case (.A, .B): break }
And, as a sanity check, these all work (as expected):
switch (e, f) { case (.A, .A): break case (.A, .B): break case (.B, .A): break case (.B, .B): break } switch (e, f) { case (_, _): break } switch (e, f) { case (.A, _): break case (.B, _): break } switch (e, f) { case (_, .A): break case (_, .B): break }
Sorry, something went wrong.
Resolved on master by #8908.
CodaFi
No branches or pull requests
Environment
Apple Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift 1f2908b)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: 46b2753712c7c2ea13b96fc0d7a94fb7
is duplicated by:
relates to:
Issue Description:
The compiler fails to see that this is an exhaustive switch statement:
It accepts the following as exhaustive, but fails to warn that the last case will never be executed:
It does not accept the following as exhaustive (same as the one above, except (.A, .A) is now the first case):
The text was updated successfully, but these errors were encountered: