Skip to content

Commit bc6ea5b

Browse files
authored
Merge pull request #7898 from jckarter/assoc-inference-protocol-refinement-test
Add regression test for SR-4143 with assoc types crossing inheritance boundaries.
2 parents 9254a3b + 092a273 commit bc6ea5b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/Constraints/associated_types.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,28 @@ struct UsesSameTypedDefaultWithReqts: SameTypedDefaultWithReqts {
8484
struct UsesSameTypedDefaultWithoutSatisfyingReqts: SameTypedDefaultWithReqts {
8585
static var y: YType { return YType() }
8686
}
87+
88+
protocol SameTypedDefaultBaseWithReqts {
89+
associatedtype X: XReqt // expected-note{{}}
90+
static var x: X { get }
91+
}
92+
protocol SameTypedDefaultDerivedWithReqts: SameTypedDefaultBaseWithReqts {
93+
associatedtype Y: YReqt
94+
static var y: Y { get }
95+
}
96+
97+
extension SameTypedDefaultDerivedWithReqts where Y == X {
98+
static var x: X {
99+
return y
100+
}
101+
}
102+
103+
struct UsesSameTypedDefaultDerivedWithReqts: SameTypedDefaultDerivedWithReqts {
104+
static var y: XYType { return XYType() }
105+
}
106+
107+
// expected-error@+1{{does not conform}}
108+
struct UsesSameTypedDefaultDerivedWithoutSatisfyingReqts: SameTypedDefaultDerivedWithReqts {
109+
static var y: YType { return YType() }
110+
}
111+

0 commit comments

Comments
 (0)