Skip to content

Commit 4f87899

Browse files
committed
Add regression test for rdar://54394068
1 parent bc939d7 commit 4f87899

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// RUN: %target-swift-frontend -typecheck -verify %s
2+
3+
protocol A {
4+
associatedtype BType: B where BType.AType == Self
5+
associatedtype CType: C where CType.AType == Self
6+
7+
var b: BType { get }
8+
var c: CType { get set }
9+
10+
func bGetter() -> BType
11+
mutating func cSetter(_ newC: CType)
12+
13+
subscript (b: BType) -> CType { get set }
14+
}
15+
16+
protocol B {
17+
associatedtype AType: A
18+
}
19+
20+
protocol C {
21+
associatedtype AType: A
22+
}
23+
24+
struct AImpl: A {
25+
typealias BType = BImpl
26+
typealias CType = CImpl
27+
28+
let b: BImpl
29+
var c: CImpl
30+
31+
func bGetter() -> BImpl {
32+
return b
33+
}
34+
35+
mutating func cSetter(_ newC: CImpl) {
36+
c = newC
37+
}
38+
39+
subscript(b: BImpl) -> CImpl {
40+
get {
41+
return c
42+
}
43+
set {
44+
c = newValue
45+
}
46+
}
47+
}
48+
49+
struct BImpl: B {
50+
typealias AType = AImpl
51+
}
52+
53+
struct CImpl: C {
54+
typealias AType = AImpl
55+
}

0 commit comments

Comments
 (0)