File: canonical_concrete_substitutions_in_protocol.swift

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (70 lines) | stat: -rw-r--r-- 1,981 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s

struct G<T> {}

// CHECK-LABEL: canonical_concrete_substitutions_in_protocol.(file).P@
// CHECK-NEXT: Requirement signature: <Self where Self.[P]A == G<Self.[P]B>, Self.[P]B == Self.[P]T.[Q]X, Self.[P]T : Q>

protocol P {
  associatedtype A where A == G<T.X>
  associatedtype B where B == T.X
  associatedtype T : Q
}

protocol Q {
  associatedtype X
}

protocol QQ : Q {}

protocol R {
  associatedtype A
  associatedtype C: QQ where C.X == G<A>
}

// Make sure substitutions which are themselves concrete simplify recursively.

// CHECK-LABEL: canonical_concrete_substitutions_in_protocol.(file).P1@
// CHECK-NEXT: Requirement signature: <Self where Self.[P1]T == Int, Self.[P1]U == G<Int>>

protocol P1 {
  associatedtype T where T == Int
  associatedtype U where U == G<T>
}

// CHECK-LABEL: canonical_concrete_substitutions_in_protocol.(file).P2@
// CHECK-NEXT: Requirement signature: <Self where Self.[P2]T == Int, Self.[P2]U == G<Int>>

protocol P2 {
  associatedtype U where U == G<T>
  associatedtype T where T == Int
}

// CHECK-LABEL: canonical_concrete_substitutions_in_protocol.(file).P3@
// CHECK-NEXT: Requirement signature: <Self where Self.[P3]T == G<Int>, Self.[P3]U == Int>

protocol P3 {
  associatedtype T where T == G<U>
  associatedtype U where U == Int
}

// CHECK-LABEL: canonical_concrete_substitutions_in_protocol.(file).P4@
// CHECK-NEXT: Requirement signature: <Self where Self.[P4]T == G<Int>, Self.[P4]U == Int>

protocol P4 {
  associatedtype U where U == Int
  associatedtype T where T == G<U>
}

protocol P5a {
  associatedtype T where T == G<U>
  associatedtype U
}

// CHECK-LABEL: canonical_concrete_substitutions_in_protocol.(file).P5@
// CHECK-NEXT: Requirement signature: <Self where Self.[P5]T == G<G<Int>>, Self.[P5]U : P5a, Self.[P5]U.[P5a]U == Int>

protocol P5 {
  associatedtype T where T == G<U.T>
  associatedtype U : P5a where U.U == Int
}