Skip to content

Commit 561e635

Browse files
committed
Pass -requirement-machine-protocol-signatures=off in three tests
1 parent 5276953 commit 561e635

File tree

5 files changed

+71
-48
lines changed

5 files changed

+71
-48
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=off
2+
// RUN: %target-swift-frontend -debug-generic-signatures -typecheck %s -requirement-machine-protocol-signatures=off 2>&1 | %FileCheck %s
3+
4+
// FIXME: Implement concrete contraction for the Requirement Machine's
5+
// RequirementSignatureRequest to get this to pass without turning off
6+
// -requirement-machine-protocol-signatures.
7+
8+
protocol P24 {
9+
associatedtype C: P20
10+
}
11+
12+
protocol P20 { }
13+
14+
struct X24<T: P20> : P24 {
15+
typealias C = T
16+
}
17+
18+
protocol P26 {
19+
associatedtype C: X3
20+
}
21+
22+
struct X26<T: X3> : P26 {
23+
typealias C = T
24+
}
25+
26+
class X3 { }
27+
28+
// CHECK-LABEL: .P25a@
29+
// CHECK-NEXT: Requirement signature: <Self where Self.[P25a]A == X24<Self.[P25a]B>, Self.[P25a]B : P20>
30+
// CHECK-NEXT: Canonical requirement signature: <τ_0_0 where τ_0_0.[P25a]A == X24<τ_0_0.[P25a]B>, τ_0_0.[P25a]B : P20>
31+
protocol P25a {
32+
associatedtype A: P24 // expected-warning{{redundant conformance constraint 'Self.A' : 'P24'}}
33+
associatedtype B: P20 where A == X24<B> // expected-note{{conformance constraint 'Self.A' : 'P24' implied here}}
34+
}
35+
36+
// CHECK-LABEL: .P25b@
37+
// CHECK-NEXT: Requirement signature: <Self where Self.[P25b]A == X24<Self.[P25b]B>, Self.[P25b]B : P20>
38+
// CHECK-NEXT: Canonical requirement signature: <τ_0_0 where τ_0_0.[P25b]A == X24<τ_0_0.[P25b]B>, τ_0_0.[P25b]B : P20>
39+
protocol P25b {
40+
associatedtype A
41+
associatedtype B: P20 where A == X24<B>
42+
}
43+
44+
// CHECK-LABEL: .P27a@
45+
// CHECK-NEXT: Requirement signature: <Self where Self.[P27a]A == X26<Self.[P27a]B>, Self.[P27a]B : X3>
46+
// CHECK-NEXT: Canonical requirement signature: <τ_0_0 where τ_0_0.[P27a]A == X26<τ_0_0.[P27a]B>, τ_0_0.[P27a]B : X3>
47+
protocol P27a {
48+
associatedtype A: P26 // expected-warning{{redundant conformance constraint 'Self.A' : 'P26'}}
49+
50+
associatedtype B: X3 where A == X26<B> // expected-note{{conformance constraint 'Self.A' : 'P26' implied here}}
51+
}
52+
53+
// CHECK-LABEL: .P27b@
54+
// CHECK-NEXT: Requirement signature: <Self where Self.[P27b]A == X26<Self.[P27b]B>, Self.[P27b]B : X3>
55+
// CHECK-NEXT: Canonical requirement signature: <τ_0_0 where τ_0_0.[P27b]A == X26<τ_0_0.[P27b]B>, τ_0_0.[P27b]B : X3>
56+
protocol P27b {
57+
associatedtype A
58+
associatedtype B: X3 where A == X26<B>
59+
}

test/Generics/requirement_inference.swift

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-typecheck-verify-swift
2-
// RUN: %target-typecheck-verify-swift -debug-generic-signatures > %t.dump 2>&1
1+
// RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=verify
2+
// RUN: %target-typecheck-verify-swift -debug-generic-signatures > %t.dump -requirement-machine-protocol-signatures=verify 2>&1
33
// RUN: %FileCheck %s < %t.dump
44

55
protocol P1 {
@@ -323,22 +323,6 @@ struct X24<T: P20> : P24 {
323323
typealias C = T
324324
}
325325

326-
// CHECK-LABEL: .P25a@
327-
// CHECK-NEXT: Requirement signature: <Self where Self.[P25a]A == X24<Self.[P25a]B>, Self.[P25a]B : P20>
328-
// CHECK-NEXT: Canonical requirement signature: <τ_0_0 where τ_0_0.[P25a]A == X24<τ_0_0.[P25a]B>, τ_0_0.[P25a]B : P20>
329-
protocol P25a {
330-
associatedtype A: P24 // expected-warning{{redundant conformance constraint 'Self.A' : 'P24'}}
331-
associatedtype B: P20 where A == X24<B> // expected-note{{conformance constraint 'Self.A' : 'P24' implied here}}
332-
}
333-
334-
// CHECK-LABEL: .P25b@
335-
// CHECK-NEXT: Requirement signature: <Self where Self.[P25b]A == X24<Self.[P25b]B>, Self.[P25b]B : P20>
336-
// CHECK-NEXT: Canonical requirement signature: <τ_0_0 where τ_0_0.[P25b]A == X24<τ_0_0.[P25b]B>, τ_0_0.[P25b]B : P20>
337-
protocol P25b {
338-
associatedtype A
339-
associatedtype B: P20 where A == X24<B>
340-
}
341-
342326
protocol P25c {
343327
associatedtype A: P24
344328
associatedtype B where A == X<B> // expected-error{{cannot find type 'X' in scope}}
@@ -349,32 +333,6 @@ protocol P25d {
349333
associatedtype B where A == X24<B> // expected-error{{type 'Self.B' does not conform to protocol 'P20'}}
350334
}
351335

352-
// Similar to the above, but with superclass constraints.
353-
protocol P26 {
354-
associatedtype C: X3
355-
}
356-
357-
struct X26<T: X3> : P26 {
358-
typealias C = T
359-
}
360-
361-
// CHECK-LABEL: .P27a@
362-
// CHECK-NEXT: Requirement signature: <Self where Self.[P27a]A == X26<Self.[P27a]B>, Self.[P27a]B : X3>
363-
// CHECK-NEXT: Canonical requirement signature: <τ_0_0 where τ_0_0.[P27a]A == X26<τ_0_0.[P27a]B>, τ_0_0.[P27a]B : X3>
364-
protocol P27a {
365-
associatedtype A: P26 // expected-warning{{redundant conformance constraint 'Self.A' : 'P26'}}
366-
367-
associatedtype B: X3 where A == X26<B> // expected-note{{conformance constraint 'Self.A' : 'P26' implied here}}
368-
}
369-
370-
// CHECK-LABEL: .P27b@
371-
// CHECK-NEXT: Requirement signature: <Self where Self.[P27b]A == X26<Self.[P27b]B>, Self.[P27b]B : X3>
372-
// CHECK-NEXT: Canonical requirement signature: <τ_0_0 where τ_0_0.[P27b]A == X26<τ_0_0.[P27b]B>, τ_0_0.[P27b]B : X3>
373-
protocol P27b {
374-
associatedtype A
375-
associatedtype B: X3 where A == X26<B>
376-
}
377-
378336
// ----------------------------------------------------------------------------
379337
// Inference of associated type relationships within a protocol hierarchy
380338
// ----------------------------------------------------------------------------

test/decl/protocol/existential_member_accesses_self_assoctype.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// RUN: %target-typecheck-verify-swift -disable-availability-checking
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking -requirement-machine-protocol-signatures=off
2+
3+
// TODO: Get this to pass with -requirement-machine-protocol-signatures=on.
24

35
//===----------------------------------------------------------------------===//
46
// Use of protocols with Self or associated type requirements

test/decl/protocol/req/associated_type_inference_fixed_type.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
// RUN: %target-typecheck-verify-swift
2-
// RUN: not %target-swift-frontend -typecheck -dump-type-witness-systems %s 2>&1 | %FileCheck %s
1+
// RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=off
2+
// RUN: not %target-swift-frontend -typecheck -dump-type-witness-systems %s -requirement-machine-protocol-signatures=off 2>&1 | %FileCheck %s
3+
4+
// TODO: Get this to pass with -requirement-machine-protocol-signatures=on.
35

46
protocol P1 where A == Never {
57
associatedtype A

validation-test/compiler_crashers_2_fixed/rdar56398071.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// RUN: %target-swift-frontend -primary-file %s -emit-ir
1+
// RUN: %target-swift-frontend -primary-file %s -emit-ir -requirement-machine-protocol-signatures=off
2+
3+
// TODO: Get this to pass with -requirement-machine-protocol-signatures=on.
24

35
public protocol WrappedSignedInteger: SignedInteger where Stride == Int {
46
typealias WrappedInteger = Int

0 commit comments

Comments
 (0)