-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
associated type inferencebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfconformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancestype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Describe the bug
Concrete implementation of a generic protocol does not inherit the type aliases from the generic protocol
Steps To Reproduce
protocol MyThing<First, Second> {
associatedtype First
associatedtype Second
typealias Convenience = (Result<First, Error>) -> Void
func doSomething(completion: @escaping Convenience)
}
protocol MyMoreConcreteThing: MyThing<String, Int> {
}
class MyConcreteThing: MyMoreConcreteThing {
var completion: Convenience?
func doSomething(completion: @escaping Convenience) { // ERROR HERE: Reference to invalid type alias
}
}
This won't build due to the error: "Reference to invalid type alias 'Convenience' of type 'MyConcreteThing'". However the concrete implementation of the generic protocol should still have access to the generic protocol's type alias.
Metadata
Metadata
Assignees
Labels
associated type inferencebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfconformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancestype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis