-
-
Save tarunon/f211f246d126d6ffdbdb931a2b95e084 to your computer and use it in GitHub Desktop.
Cannot compile code on Swift 3.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol X {} | |
extension String: X {} | |
enum A { | |
case hoge(Any) | |
case fuga(X) | |
} | |
let a = A.fuga("hello") | |
switch a { | |
case .hoge(let x as X), | |
.fuga(let x): | |
print(x) | |
default: | |
break | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
enumのcaseの変数をprotocol型で取り出そうとするとコンパイルが通らなくなるようだ。