Last active
December 27, 2015 23:32
-
-
Save hiroshi-maybe/d39aebac6677484ad968 to your computer and use it in GitHub Desktop.
Swift compile error in Xcode 7.1
This file contains hidden or 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 MyProtocol: class { | |
| typealias MyAlias | |
| var something: MyAlias { get } | |
| } | |
| extension MyProtocol where MyAlias: YourProtocol { | |
| func bar() { | |
| // !!! Compile Error happens !!! | |
| // expected an argument list of type '(Self.AliasTypeAlias)' | |
| // self.something.foo { _ in print("X") } | |
| // ^ | |
| self.something.foo { _ in print("X") } | |
| } | |
| } | |
| protocol YourProtocol: class { | |
| typealias Model | |
| typealias AliasTypeAlias = Model -> () | |
| func foo(callback: AliasTypeAlias) | |
| // below works. looks like compiler is confused by type variable and real alias | |
| // func foo(callback: Model -> ()) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment