Skip to content

Instantly share code, notes, and snippets.

@335g
Last active August 29, 2015 14:25
Show Gist options
  • Save 335g/607bb9ae597405da050c to your computer and use it in GitHub Desktop.
Save 335g/607bb9ae597405da050c to your computer and use it in GitHub Desktop.
引数のタプル受け取りはジェネリクス使った関数だとNG
/// Xcode7 beta4
struct MyInt {
var a: Int
}
struct MyGenerics<T> {
var a: T
}
func func1(a: MyInt, _ b: Int) {}
func func2(a: MyGenerics<Int>, _ b: Int) {}
func func3<T>(a: MyGenerics<T>, _ b: Int) {}
let t1: (MyInt, Int) = (MyInt(a: 0), 0)
let t2: (MyGenerics<Int>, Int) = (MyGenerics(a: 0), 0)
func1(t1) // OK
func2(t2) // OK
func3(t2) // NG
let func4: (MyGenerics<Int>, Int) -> () = func3
func4(t2) // OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment