Skip to content

Instantly share code, notes, and snippets.

@hiroshi-maybe
Last active December 27, 2015 23:32
Show Gist options
  • Select an option

  • Save hiroshi-maybe/d39aebac6677484ad968 to your computer and use it in GitHub Desktop.

Select an option

Save hiroshi-maybe/d39aebac6677484ad968 to your computer and use it in GitHub Desktop.
Swift compile error in Xcode 7.1
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