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
Swift version 4.1-dev (LLVM b1f1b1f5b8, Clang d8b11579e8, Swift a455db6)
Target: x86_64-apple-darwin17.3.0
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: aecd7e6fe6ed6d3cd2c53f25c945b2e6
Issue Description:
The following fails to compile:
enumE {
casea
}
funcfoo<T>(_t: T) {
switcht {
caseE.a: // error: Enum case 'a' is not a member of type 'T'print("is E.a")
default:
print("isn't E.a")
}
}
However it does compile if the value being switched over is an existential:
extensionError {
funcfoo() {
switchself {
caseE.a: // error: Enum case 'a' is not a member of type 'Self'print("is E.a")
default:
print("isn't E.a")
}
}
}
vare: Error = E.ae.foo()
Environment
Swift version 4.1-dev (LLVM b1f1b1f5b8, Clang d8b11579e8, Swift a455db6)
Target: x86_64-apple-darwin17.3.0
Additional Detail from JIRA
md5: aecd7e6fe6ed6d3cd2c53f25c945b2e6
Issue Description:
The following fails to compile:
However it does compile if the value being switched over is an existential:
Unless there's a good reason not to allow this, IMO the logic in TypeCheckPattern.cpp should check for archetypes as well as existentials.
The text was updated successfully, but these errors were encountered: