Skip to content

Commit db801a5

Browse files
committed
RequirementMachine: Add redundant requirements diagnostic test that used to fail with the GSB
For some reason we didn't diagnose some of the redundancies here; the new logic in the Requirement Machine works just fine though! https://bugs.swift.org/browse/SR-14917 / rdar://problem/80820294
1 parent 305a1e4 commit db801a5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/Generics/sr14917.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %target-typecheck-verify-swift -requirement-machine-inferred-signatures=on
2+
3+
protocol P {
4+
associatedtype A
5+
associatedtype AS: Q where AS.B == A
6+
}
7+
8+
protocol Q {
9+
associatedtype B
10+
}
11+
12+
struct S1<T : P> where T.AS.B == T.A {}
13+
// expected-warning@-1 {{redundant same-type constraint 'T.AS.B' == 'T.A'}}
14+
15+
struct S2<T: P> {
16+
struct Nested where T.AS.B == T.A {}
17+
// expected-warning@-1 {{redundant same-type constraint 'T.AS.B' == 'T.A'}}
18+
}
19+
20+
extension S2 where T.AS.B == T.A {}
21+
// expected-warning@-1 {{redundant same-type constraint 'T.AS.B' == 'T.A'}}
22+
23+
extension P where AS.B == A {}
24+
// expected-warning@-1 {{redundant same-type constraint 'Self.AS.B' == 'Self.A'}}
25+
26+
extension P where Self : P {}
27+
// expected-warning@-1 {{redundant conformance constraint 'Self' : 'P'}}

0 commit comments

Comments
 (0)