Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
これ、'T' does not have a member type named 'A'; did you mean 'A'? になる #swift #CodePiece
func foo<T: P>(a: T) -> T.A {
fatalError()
}
struct B {}
protocol P {}
extension P {
typealias A = B
}
Owner

kateinoigakukun commented Oct 7, 2017

struct B {}
protocol P {}
extension P {
    typealias A = B
}
func foo<T: P>(a: T) -> T.A {
    fatalError()
}

func foo<T: P>(a: T) -> T.A {
    fatalError()
}
struct B {}
protocol P {
    associatedtype A
}

extension P {
    typealias A = B
}

にすると通るようになる。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment