1- // RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s
2- // RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -disable-requirement-machine-concrete-contraction 2>&1 | %FileCheck %s
1+ // RUN: %target-swift-frontend -typecheck -verify %s -debug-generic-signatures 2>&1 | %FileCheck %s
2+ // RUN: %target-swift-frontend -typecheck -verify %s -debug-generic-signatures -disable-requirement-machine-concrete-contraction 2>&1 | %FileCheck %s
33
44protocol P {
55 associatedtype T
@@ -15,49 +15,60 @@ protocol Q {
1515protocol R { }
1616
1717// CHECK-LABEL: abstract_type_witnesses_in_protocols.(file).Q1@
18- // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<Self.[Q]A.[P]T >, Self.[Q1]B : P, Self.[Q]A.[P]T == Self.[Q1]B.[P]T>
18+ // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<<<error type>> >, Self.[Q1]B : P, Self.[Q]A.[P]T == Self.[Q1]B.[P]T>
1919
2020// GSB: Non-canonical requirement
21+ // expected-error@+1 {{same-type constraint 'Self.A' == 'G<Self.A.T>' is recursive}}
2122protocol Q1 : Q {
2223 associatedtype B : P where A == G < B . T >
2324}
2425
26+ // This used to crash
27+ func useQ1< T : Q1 > ( _: T ) -> T . A . T . Type {
28+ return T . A. T. Type
29+ }
30+
2531// CHECK-LABEL: abstract_type_witnesses_in_protocols.(file).Q1a@
26- // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<Self.[Q]A.[P]T >, Self.[Q1a]B : P, Self.[Q]A.[P]T : R, Self.[Q]A.[P]T == Self.[Q1a]B.[P]T>
32+ // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<<<error type>> >, Self.[Q1a]B : P, Self.[Q]A.[P]T : R, Self.[Q]A.[P]T == Self.[Q1a]B.[P]T>
2733
2834// GSB: Missing requirement
35+ // expected-error@+1 {{same-type constraint 'Self.A' == 'G<Self.A.T>' is recursive}}
2936protocol Q1a : Q {
3037 associatedtype B : P where A. T : R , A == G < B . T >
3138}
3239
3340// CHECK-LABEL: abstract_type_witnesses_in_protocols.(file).Q1b@
34- // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<Self.[Q]A.[P]T >, Self.[Q1b]B : P, Self.[Q]A.[P]T : R, Self.[Q]A.[P]T == Self.[Q1b]B.[P]T>
41+ // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<<<error type>> >, Self.[Q1b]B : P, Self.[Q]A.[P]T : R, Self.[Q]A.[P]T == Self.[Q1b]B.[P]T>
3542
3643// GSB: Non-canonical requirement
44+ // expected-error@+1 {{same-type constraint 'Self.A' == 'G<Self.A.T>' is recursive}}
3745protocol Q1b : Q {
3846 associatedtype B : P where B. T : R , A == G < B . T >
3947}
4048
4149// CHECK-LABEL: abstract_type_witnesses_in_protocols.(file).Q2@
42- // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<Self.[Q]A.[P]T >, Self.[Q2]B : P, Self.[Q]A.[P]T == Self.[Q2]B.[P]T>
50+ // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<<<error type>> >, Self.[Q2]B : P, Self.[Q]A.[P]T == Self.[Q2]B.[P]T>
4351
4452// GSB: Missing requirement
53+ // expected-error@+1 {{same-type constraint 'Self.A' == 'G<Self.A.T>' is recursive}}
4554protocol Q2 : Q {
4655 associatedtype B : P where A. T == B . T , A == G < B . T >
4756}
4857
4958// CHECK-LABEL: abstract_type_witnesses_in_protocols.(file).Q3@
50- // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<Self.[Q]A.[P]T >, Self.[Q3]B : P, Self.[Q]A.[P]T == Self.[Q3]B.[P]T>
59+ // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<<<error type>> >, Self.[Q3]B : P, Self.[Q]A.[P]T == Self.[Q3]B.[P]T>
5160
5261// GSB: Unsupported recursive requirement
62+ // expected-error@+1 {{same-type constraint 'Self.A' == 'G<Self.A.T>' is recursive}}
5363protocol Q3 : Q {
5464 associatedtype B : P where A == G < A . T > , A. T == B . T
5565}
5666
5767// CHECK-LABEL: abstract_type_witnesses_in_protocols.(file).Q4@
58- // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<Self.[Q]A.[P]T >, Self.[Q4]B : P, Self.[Q]A.[P]T == Self.[Q4]B.[P]T>
68+ // CHECK-NEXT: Requirement signature: <Self where Self : Q, Self.[Q]A == G<<<error type>> >, Self.[Q4]B : P, Self.[Q]A.[P]T == Self.[Q4]B.[P]T>
5969
6070// GSB: Unsupported recursive requirement
71+ // expected-error@+1 {{same-type constraint 'Self.A' == 'G<Self.A.T>' is recursive}}
6172protocol Q4 : Q {
6273 associatedtype B : P where A. T == B . T , A == G < A . T >
6374}
0 commit comments