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
Although `default` will never be executed in the second switch statement in the following code, the compiler shows only a warning about the first switch statement.
[Code]
enumE {
casea,b
}
funcf(_e0:E, _e1:E) {
switch (e0, e1) {
case (.a, _): print("e0 is .a")
case (.b, _): print("e0 is .b")
default: print("e0 is what...?") // -> warning: default will never be executed
}
switch (e0, e1) {
case (.a, _), (_, .a): print("e0 or e1 is .a")
case (.b, _): print("e0 is .b")
default: print("e0 is what...?") // -> No warning
}
}
f(.a, .a)
f(.a, .b)
f(.b, .a)
f(.b, .b)
The text was updated successfully, but these errors were encountered:
On the other hand, as shown below, the compiler indicates a wrong error "case will never be executed" even if it must be executed.
enumE {
casea// only one case
}
funcf(_e0:E, _e1:E) {
switch (e0, e1) {
case (.a, _): print("e0 is .a")
}
switch (e0, e1) {
case (.a, _), (_, .a): print("e0 or e1 is .a") // -> warning: case will never be executed
}
}
f(.a, .a)
Ah, that second issue is trying to say the second pattern will never match, not the entire case. Can you file a separate bug to clean up that diagnostic?
CodaFi (JIRA User), @xedin, what do you think about this one? Is this supposed to be caught in the Space Engine or in SIL?
Environment
OS: macOS, Ubuntu 16.04
Swift: 4.1.2, 4.2-DEVELOPMENT-SNAPSHOT-2018-07-08
Additional Detail from JIRA
md5: 9d87fa186411d1838211549f925233c3
Issue Description:
Although `default` will never be executed in the second switch statement in the following code, the compiler shows only a warning about the first switch statement.
[Code]
The text was updated successfully, but these errors were encountered: