[swift-evolution] generic typealias inside generic type
Vladimir.S
svabox at gmail.com
Fri Jun 17 13:06:33 CDT 2016
Please consider this code:
struct Foo<T> {
typealias Group<Key,Value> = (key:Key, group:[Value])
func bar<U,V>(u: U, v: V) -> Foo<Group<U,V>> {
return Foo<Group<U,V>>()
}
}
It will not compile:
cannot specialize non-generic type '(key: Key, group: [Value])'
But this will work as expected:
typealias Group<Key,Value> = (key:Key, group:[Value])
struct Foo<T> {
func bar<U,V>(u: U, v: V) -> Foo<Group<U,V>> {
return Foo<Group<U,V>>()
}
}
Shouldn't we be able to work with Group typealias inside Foo<T> without
problems as it has no any relationship to generic type T ? Or I'm missing
something?
More information about the swift-evolution
mailing list