Skip to content

Commit 5493e01

Browse files
committed
Add regression test for rdar://problem/91771352
1 parent 9365af6 commit 5493e01

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/Generics/rdar91771352.swift

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: %target-typecheck-verify-swift
2+
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s
3+
4+
public struct G<T: P1, U: P1> {
5+
// CHECK-LABEL: .f1()@
6+
// CHECK-NEXT: Generic signature: <T, U where T : P1, T == U>
7+
public func f1() where T == U {}
8+
9+
// CHECK-LABEL: .f2()@
10+
// CHECK-NEXT: Generic signature: <T, U where T : P1, T == U>
11+
public func f2() where T == U, T.A.B == T {}
12+
// expected-warning@-1 {{redundant same-type constraint 'T.A.B' == 'T'}}
13+
14+
// CHECK-LABEL: .f3()@
15+
// CHECK-NEXT: Generic signature: <T, U where T : P1, T == U>
16+
public func f3() where T.A.B == T, T == U {}
17+
// expected-warning@-1 {{redundant same-type constraint 'T.A.B' == 'T'}}
18+
19+
// CHECK-LABEL: .f4()@
20+
// CHECK-NEXT: Generic signature: <T, U where T : P1, T == U>
21+
public func f4() where U.A.B == U, T == U {}
22+
// expected-warning@-1 {{redundant same-type constraint 'U.A.B' == 'U'}}
23+
}
24+
25+
public protocol P1 {
26+
associatedtype A: P2 where A.B == Self
27+
}
28+
29+
public protocol P2 {
30+
associatedtype B: P1
31+
}

0 commit comments

Comments
 (0)