Skip to content

Commit 51e88b1

Browse files
committed
Test: update for NoncopyableGenerics
(cherry picked from commit 8f97b7f)
1 parent 6c5a6a3 commit 51e88b1

File tree

1 file changed

+82
-26
lines changed

1 file changed

+82
-26
lines changed

test/Frontend/debug-generic-signatures.swift

Lines changed: 82 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// RUN: %target-swift-frontend -typecheck -debug-generic-signatures %s 2>&1 | %FileCheck %s
22

3-
// XFAIL: noncopyable_generics
4-
53
// CHECK-LABEL: main.(file).P1@
64
// CHECK: Requirement signature: <Self>
75
protocol P1 {
@@ -27,7 +25,7 @@ protocol P3 {
2725
// CHECK-LABEL: StructDecl name=Basic
2826
// CHECK: (normal_conformance type="Basic" protocol="P1"
2927
// CHECK-NEXT: (assoc_type req="A" type="Int")
30-
// CHECK-NEXT: (value req="f()" witness="main.(file).Basic.f()@{{.*}}"))
28+
// CHECK-NEXT: (value req="f()" witness="main.(file).Basic.f()@{{.*}}")
3129
struct Basic: P1 {
3230
typealias A = Int
3331
func f() -> Int { fatalError() }
@@ -36,9 +34,15 @@ struct Basic: P1 {
3634
// Recursive conformances should have finite output.
3735

3836
// CHECK-LABEL: StructDecl name=Recur
37+
// CHECK-NEXT: (builtin_conformance type="Recur" protocol="Copyable")
38+
// CHECK-NEXT: (builtin_conformance type="Recur" protocol="Escapable")
3939
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2"
4040
// CHECK-NEXT: (assoc_type req="A" type="Recur")
4141
// CHECK-NEXT: (assoc_type req="B" type="Recur")
42+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
43+
// CHECK-NEXT: (builtin_conformance type="Recur" protocol="Copyable"))
44+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
45+
// CHECK-NEXT: (builtin_conformance type="Recur" protocol="Escapable"))
4246
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P2"
4347
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
4448
// CHECK-NEXT: (assoc_conformance type="Self.B" proto="P2"
@@ -51,13 +55,23 @@ struct Recur: P2 {
5155
// The full information about a conformance doesn't need to be printed twice.
5256

5357
// CHECK-LABEL: StructDecl name=NonRecur
58+
// CHECK-NEXT: (builtin_conformance type="NonRecur" protocol="Copyable")
59+
// CHECK-NEXT: (builtin_conformance type="NonRecur" protocol="Escapable")
5460
// CHECK-NEXT: (normal_conformance type="NonRecur" protocol="P2"
5561
// CHECK-NEXT: (assoc_type req="A" type="Recur")
5662
// CHECK-NEXT: (assoc_type req="B" type="Recur")
63+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
64+
// CHECK-NEXT: (builtin_conformance type="NonRecur" protocol="Copyable"))
65+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
66+
// CHECK-NEXT: (builtin_conformance type="NonRecur" protocol="Escapable"))
5767
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P2"
5868
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2"
5969
// CHECK-NEXT: (assoc_type req="A" type="Recur")
6070
// CHECK-NEXT: (assoc_type req="B" type="Recur")
71+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
72+
// CHECK-NEXT: (builtin_conformance type="Recur" protocol="Copyable"))
73+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
74+
// CHECK-NEXT: (builtin_conformance type="Recur" protocol="Escapable"))
6175
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P2"
6276
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
6377
// CHECK-NEXT: (assoc_conformance type="Self.B" proto="P2"
@@ -79,7 +93,15 @@ struct Generic<T> {}
7993
// CHECK-NEXT: (normal_conformance type="Generic<T>" protocol="P1"
8094
// CHECK-NEXT: (assoc_type req="A" type="T")
8195
// CHECK-NEXT: (value req="f()" witness="main.(file).Generic extension.f()@{{.*}}")
82-
// CHECK-NEXT: (requirement "T" conforms_to "P1")
96+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
97+
// CHECK-NEXT: (builtin_conformance type="Generic<T>" protocol="Copyable"))
98+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
99+
// CHECK-NEXT: (builtin_conformance type="Generic<T>" protocol="Escapable"))
100+
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="Copyable"
101+
// CHECK-NEXT: (abstract_conformance protocol="Copyable"))
102+
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="Escapable"
103+
// CHECK-NEXT: (abstract_conformance protocol="Escapable"))
104+
// CHECK-NEXT: (requirement "T" conforms_to "P1"))
83105
extension Generic: P1 where T: P1 {
84106
typealias A = T
85107
func f() -> T { fatalError() }
@@ -96,6 +118,10 @@ class Super<T, U> {}
96118
// CHECK-NEXT: (normal_conformance type="Super<T, U>" protocol="P2"
97119
// CHECK-NEXT: (assoc_type req="A" type="T")
98120
// CHECK-NEXT: (assoc_type req="B" type="T")
121+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
122+
// CHECK-NEXT: (builtin_conformance type="Super<T, U>" protocol="Copyable"))
123+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
124+
// CHECK-NEXT: (builtin_conformance type="Super<T, U>" protocol="Escapable"))
99125
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P2"
100126
// CHECK-NEXT: (abstract_conformance protocol="P2"))
101127
// CHECK-NEXT: (assoc_conformance type="Self.B" proto="P2"
@@ -109,33 +135,47 @@ extension Super: P2 where T: P2, U: P2 {
109135

110136
// Inherited/specialized conformances.
111137
// CHECK-LABEL: ClassDecl name=Sub
138+
// CHECK-NEXT: (builtin_conformance type="Sub" protocol="Copyable")
139+
// CHECK-NEXT: (builtin_conformance type="Sub" protocol="Escapable")
112140
// CHECK-NEXT: (inherited_conformance type="Sub" protocol="P2"
113141
// CHECK-NEXT: (specialized_conformance type="Super<NonRecur, Recur>" protocol="P2"
114-
// CHECK-NEXT: (substitution_map generic_signature=<T, U where T : P2, U : P2>
115-
// CHECK-NEXT: (substitution T ->
116-
// CHECK-NEXT: (struct_type decl="{{.*}}"))
117-
// CHECK-NEXT: (substitution U ->
118-
// CHECK-NEXT: (struct_type decl="{{.*}}"))
119-
// CHECK-NEXT: (conformance type="T"
120-
// CHECK-NEXT: (normal_conformance type="NonRecur" protocol="P2"
121-
// CHECK-NEXT: (assoc_type req="A" type="Recur")
122-
// CHECK-NEXT: (assoc_type req="B" type="Recur")
123-
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P2"
124-
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2"
125-
// CHECK-NEXT: (assoc_type req="A" type="Recur")
126-
// CHECK-NEXT: (assoc_type req="B" type="Recur")
127-
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P2"
128-
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
129-
// CHECK-NEXT: (assoc_conformance type="Self.B" proto="P2"
130-
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))))
131-
// CHECK-NEXT: (assoc_conformance type="Self.B" proto="P2"
132-
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))))
133-
// CHECK-NEXT: (conformance type="U"
134-
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)))
142+
// CHECK-NEXT: (substitution_map generic_signature=<T, U where T : P2, U : P2>
143+
// CHECK-NEXT: (substitution T ->
144+
// CHECK-NEXT: (struct_type decl="main.(file).NonRecur@{{.*}}"))
145+
// CHECK-NEXT: (substitution U ->
146+
// CHECK-NEXT: (struct_type decl="main.(file).Recur@{{.*}}"))
147+
// CHECK-NEXT: (conformance type="T"
148+
// CHECK-NEXT: (normal_conformance type="NonRecur" protocol="P2"
149+
// CHECK-NEXT: (assoc_type req="A" type="Recur")
150+
// CHECK-NEXT: (assoc_type req="B" type="Recur")
151+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
152+
// CHECK-NEXT: (builtin_conformance type="NonRecur" protocol="Copyable"))
153+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
154+
// CHECK-NEXT: (builtin_conformance type="NonRecur" protocol="Escapable"))
155+
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P2"
156+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2"
157+
// CHECK-NEXT: (assoc_type req="A" type="Recur")
158+
// CHECK-NEXT: (assoc_type req="B" type="Recur")
159+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
160+
// CHECK-NEXT: (builtin_conformance type="Recur" protocol="Copyable"))
161+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
162+
// CHECK-NEXT: (builtin_conformance type="Recur" protocol="Escapable"))
163+
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P2"
164+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
165+
// CHECK-NEXT: (assoc_conformance type="Self.B" proto="P2"
166+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))))
167+
// CHECK-NEXT: (assoc_conformance type="Self.B" proto="P2"
168+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))))
169+
// CHECK-NEXT: (conformance type="U"
170+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)))
135171
// CHECK-NEXT: (<conditional requirements unable to be computed>)
136172
// CHECK-NEXT: (normal_conformance type="Super<T, U>" protocol="P2"
137173
// CHECK-NEXT: (assoc_type req="A" type="T")
138174
// CHECK-NEXT: (assoc_type req="B" type="T")
175+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
176+
// CHECK-NEXT: (builtin_conformance type="Super<T, U>" protocol="Copyable"))
177+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
178+
// CHECK-NEXT: (builtin_conformance type="Super<T, U>" protocol="Escapable"))
139179
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P2"
140180
// CHECK-NEXT: (abstract_conformance protocol="P2"))
141181
// CHECK-NEXT: (assoc_conformance type="Self.B" proto="P2"
@@ -148,26 +188,42 @@ class Sub: Super<NonRecur, Recur> {}
148188
// should work through SubstitutionMaps.
149189

150190
// CHECK-LABEL: StructDecl name=RecurGeneric
191+
// CHECK-NEXT: (builtin_conformance type="RecurGeneric<T>" protocol="Copyable")
192+
// CHECK-NEXT: (builtin_conformance type="RecurGeneric<T>" protocol="Escapable")
151193
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3"
152194
// CHECK-NEXT: (assoc_type req="A" type="RecurGeneric<T>")
195+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
196+
// CHECK-NEXT: (builtin_conformance type="RecurGeneric<T>" protocol="Copyable"))
197+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
198+
// CHECK-NEXT: (builtin_conformance type="RecurGeneric<T>" protocol="Escapable"))
153199
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P3"
154200
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3" <details printed above>)))
155201
struct RecurGeneric<T: P3>: P3 {
156202
typealias A = RecurGeneric<T>
157203
}
158204

159205
// CHECK-LABEL: StructDecl name=Specialize
206+
// CHECK-NEXT: (builtin_conformance type="Specialize" protocol="Copyable")
207+
// CHECK-NEXT: (builtin_conformance type="Specialize" protocol="Escapable")
160208
// CHECK-NEXT: (normal_conformance type="Specialize" protocol="P3"
161209
// CHECK-NEXT: (assoc_type req="A" type="RecurGeneric<Specialize>")
210+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
211+
// CHECK-NEXT: (builtin_conformance type="Specialize" protocol="Copyable"))
212+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
213+
// CHECK-NEXT: (builtin_conformance type="Specialize" protocol="Escapable"))
162214
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P3"
163215
// CHECK-NEXT: (specialized_conformance type="Specialize.A" protocol="P3"
164216
// CHECK-NEXT: (substitution_map generic_signature=<T where T : P3>
165217
// CHECK-NEXT: (substitution T ->
166-
// CHECK-NEXT: (struct_type decl="{{.*}}"))
218+
// CHECK-NEXT: (struct_type decl="main.(file).Specialize@{{.*}}"))
167219
// CHECK-NEXT: (conformance type="T"
168220
// CHECK-NEXT: (normal_conformance type="Specialize" protocol="P3" <details printed above>)))
169221
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3"
170222
// CHECK-NEXT: (assoc_type req="A" type="RecurGeneric<T>")
223+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Copyable"
224+
// CHECK-NEXT: (builtin_conformance type="RecurGeneric<T>" protocol="Copyable"))
225+
// CHECK-NEXT: (assoc_conformance type="Self" proto="Escapable"
226+
// CHECK-NEXT: (builtin_conformance type="RecurGeneric<T>" protocol="Escapable"))
171227
// CHECK-NEXT: (assoc_conformance type="Self.A" proto="P3"
172228
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3" <details printed above>))))))
173229
struct Specialize: P3 {

0 commit comments

Comments
 (0)