Create a gist now

Instantly share code, notes, and snippets.

Embed
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
}
@kateinoigakukun

This comment has been minimized.

Show comment
Hide comment
@kateinoigakukun

kateinoigakukun 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
}

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

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