|
| 1 | +// RUN: %target-typecheck-verify-swift |
| 2 | + |
| 3 | +// SR-8767: a number of related problems with unqualified lookup of |
| 4 | +// associated type names. |
| 5 | + |
| 6 | + |
| 7 | +// #1 |
| 8 | +public protocol PA { |
| 9 | + associatedtype F |
| 10 | +} |
| 11 | + |
| 12 | +public protocol PDA : PA { |
| 13 | +} |
| 14 | + |
| 15 | +public protocol PrB { |
| 16 | + associatedtype F |
| 17 | +} |
| 18 | + |
| 19 | +extension PDA where Self : PrB { |
| 20 | + public init(first: F?) { |
| 21 | + fatalError() |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | +// #2 |
| 26 | +public protocol S { associatedtype F } |
| 27 | +public protocol AM : S {} |
| 28 | +public protocol AL { associatedtype F } |
| 29 | +extension AM where Self : AL { |
| 30 | + public init(first: F?) { fatalError() } |
| 31 | +} |
| 32 | + |
| 33 | +// #3 |
| 34 | +public protocol S2 { associatedtype F } |
| 35 | +public protocol A2 : S2 {} |
| 36 | +public protocol Z2 { associatedtype F } |
| 37 | +extension A2 where Self : Z2 { |
| 38 | + public init(first: F?) { fatalError() } |
| 39 | +} |
| 40 | + |
| 41 | +// #4 |
| 42 | +public protocol BM { associatedtype F } |
| 43 | +public protocol C : BM {} |
| 44 | +public protocol BL { associatedtype F } |
| 45 | +extension C where Self : BL { public init(first: F?) { fatalError() } } |
| 46 | + |
| 47 | +// #5 |
| 48 | +public protocol AZ { associatedtype F } |
| 49 | +public protocol ZA : AZ {} |
| 50 | +public protocol AA { associatedtype F } |
| 51 | +extension ZA where Self : AA { public init(first: F?) { fatalError() } } |
| 52 | + |
| 53 | +// #6 |
| 54 | +public protocol AZ2 { associatedtype F } |
| 55 | +public protocol ZA2 : AZ2 {} |
| 56 | +public protocol ZZ2 { associatedtype F } |
| 57 | +extension ZA2 where Self : ZZ2 { public init(first: F?) { fatalError() } } |
| 58 | + |
| 59 | +// #7 |
| 60 | +public protocol ZA3 { associatedtype F } |
| 61 | +public protocol AZ3 : ZA3 {} |
| 62 | +public protocol ZZ3 { associatedtype F } |
| 63 | +extension AZ3 where Self : ZZ3 { public init(first: F?) { fatalError() } } |
| 64 | + |
0 commit comments