mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
We allow protocols to inherit from protocol compositions
defined via a typealias, eg,
typealias PQ = P & Q
protocol R : PQ {}
Sometimes, ProtocolDecl::getInheritedProtocols() is called before
the protocol's requirement signature has been computed. In this
case, we walk the inheritance clause of the protocol directly.
This walk was only looking at ProtocolType members of the
inheritance clause, ignoring ProtocolCompositionTypes.
As a result, name lookup could fail with an assertion because of
not being able to "see" members inherited via the protocol
composition.
Fixes <rdar://problem/32595988>.
19 lines
292 B
Swift
19 lines
292 B
Swift
public protocol Critter {
|
|
associatedtype Fur
|
|
}
|
|
public protocol Pet {}
|
|
|
|
public typealias Cat = Critter & Pet
|
|
|
|
public protocol Kitten : Cat {}
|
|
|
|
extension Kitten {
|
|
public func pet() -> Fur {
|
|
while true {}
|
|
}
|
|
}
|
|
|
|
public final class Meow<Purrs> : Kitten {
|
|
public typealias Fur = Purrs
|
|
}
|