Skip to content

Commit 452154f

Browse files
committed
[ASTDumper] Use PrintBase for conformance dumps
1 parent b6b6054 commit 452154f

File tree

8 files changed

+334
-326
lines changed

8 files changed

+334
-326
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 239 additions & 231 deletions
Large diffs are not rendered by default.

test/Constraints/result_builder_generic_infer.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,34 @@ struct ProtocolSubstitution: P {
2222
typealias A = Int
2323

2424
// CHECK: var_decl{{.*}}x1
25-
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> Int))
25+
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> Int')
2626
var x1: [S] { S() }
2727

2828
// CHECK: var_decl{{.*}}x2
29-
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> ProtocolSubstitution))
29+
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> ProtocolSubstitution')
3030
var x2: [S] { S() }
3131
}
3232

3333
// CHECK: struct_decl{{.*}}ArchetypeSubstitution
3434
struct ArchetypeSubstitution<A>: P {
3535
// CHECK: var_decl{{.*}}x1
36-
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> A))
36+
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> A')
3737
var x1: [S] { S() }
3838

3939
// CHECK: var_decl{{.*}}x2
40-
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> ArchetypeSubstitution<A>))
40+
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> ArchetypeSubstitution<A>')
4141
var x2: [S] { S() }
4242
}
4343

4444
// CHECK-LABEL: struct_decl{{.*}}ExplicitGenericAttribute
4545
struct ExplicitGenericAttribute<T: P> {
4646
// CHECK: var_decl{{.*}}x1
47-
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> T))
47+
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> T')
4848
@Builder<T>
4949
var x1: [S] { S() }
5050

5151
// CHECK: var_decl{{.*}}x2
52-
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> T.A))
52+
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> T.A')
5353
@Builder<T.A>
5454
var x2: [S] { S() }
5555
}
@@ -61,10 +61,10 @@ extension ConcreteTypeSubstitution: P where Value == Int {
6161
typealias A = Value
6262

6363
// CHECK: var_decl{{.*}}x1
64-
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> Int))
64+
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> Int')
6565
var x1: [S] { S() }
6666

6767
// CHECK: var_decl{{.*}}x2
68-
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> ConcreteTypeSubstitution<Int>))
68+
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> ConcreteTypeSubstitution<Int>')
6969
var x2: [S] { S() }
7070
}

test/Distributed/distributed_actor_executor_ast.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ distributed actor DefaultWorker {
3737
// Check that we create the "remote reference" executor:
3838
// CHECK: (return_stmt implicit
3939
// CHECK: (call_expr implicit type="UnownedSerialExecutor" nothrow
40-
// CHECK: (declref_expr implicit type="(DefaultWorker) -> UnownedSerialExecutor" decl="Distributed.(file).buildDefaultDistributedRemoteActorExecutor [with (substitution_map generic_signature=<Act where Act : DistributedActor> (substitution Act -> DefaultWorker))]"
40+
// CHECK: (declref_expr implicit type="(DefaultWorker) -> UnownedSerialExecutor" decl="Distributed.(file).buildDefaultDistributedRemoteActorExecutor [with (substitution_map generic_signature='<Act where Act : DistributedActor>' 'Act -> DefaultWorker')]"
4141

4242
// Check the default executor synthesis for local actor otherwise:
4343
// CHECK: (return_stmt implicit
4444
// CHECK: (call_expr implicit type="Builtin.Executor" nothrow
45-
// CHECK: (declref_expr implicit type="(DefaultWorker) -> Builtin.Executor" decl="Builtin.(file).buildDefaultActorExecutorRef [with (substitution_map generic_signature=<T where T : AnyObject> (substitution T -> DefaultWorker))]" function_ref=unapplied)
45+
// CHECK: (declref_expr implicit type="(DefaultWorker) -> Builtin.Executor" decl="Builtin.(file).buildDefaultActorExecutorRef [with (substitution_map generic_signature='<T where T : AnyObject>' 'T -> DefaultWorker')]" function_ref=unapplied)

test/Frontend/debug-generic-signatures.swift

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ protocol P3 {
3232
}
3333

3434
// CHECK-LABEL: StructDecl name=Basic
35-
// CHECK: (normal_conformance type=Basic protocol=P1
36-
// CHECK-NEXT: (assoc_type req=A type=Int)
37-
// CHECK-NEXT: (value req=f() witness=main.(file).Basic.f()@{{.*}}))
35+
// CHECK: (normal_conformance type="Basic" protocol="P1"
36+
// CHECK-NEXT: (assoc_type req="A" type="Int")
37+
// CHECK-NEXT: (value req="f()" witness="main.(file).Basic.f()@{{.*}}"))
3838
struct Basic: P1 {
3939
typealias A = Int
4040
func f() -> Int { fatalError() }
@@ -43,11 +43,11 @@ struct Basic: P1 {
4343
// Recursive conformances should have finite output.
4444

4545
// CHECK-LABEL: StructDecl name=Recur
46-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2
47-
// CHECK-NEXT: (assoc_type req=A type=Recur)
48-
// CHECK-NEXT: (assoc_type req=B type=Recur)
49-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above))
50-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above)))
46+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2"
47+
// CHECK-NEXT: (assoc_type req="A" type="Recur")
48+
// CHECK-NEXT: (assoc_type req="B" type="Recur")
49+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)
50+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
5151
struct Recur: P2 {
5252
typealias A = Recur
5353
typealias B = Recur
@@ -56,15 +56,15 @@ struct Recur: P2 {
5656
// The full information about a conformance doesn't need to be printed twice.
5757

5858
// CHECK-LABEL: StructDecl name=NonRecur
59-
// CHECK-NEXT: (normal_conformance type=NonRecur protocol=P2
60-
// CHECK-NEXT: (assoc_type req=A type=Recur)
61-
// CHECK-NEXT: (assoc_type req=B type=Recur)
62-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2
63-
// CHECK-NEXT: (assoc_type req=A type=Recur)
64-
// CHECK-NEXT: (assoc_type req=B type=Recur)
65-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above))
66-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above)))
67-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above)))
59+
// CHECK-NEXT: (normal_conformance type="NonRecur" protocol="P2"
60+
// CHECK-NEXT: (assoc_type req="A" type="Recur")
61+
// CHECK-NEXT: (assoc_type req="B" type="Recur")
62+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2"
63+
// CHECK-NEXT: (assoc_type req="A" type="Recur")
64+
// CHECK-NEXT: (assoc_type req="B" type="Recur")
65+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)
66+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
67+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
6868
struct NonRecur: P2 {
6969
typealias A = Recur
7070
typealias B = Recur
@@ -77,9 +77,9 @@ struct NonRecur: P2 {
7777
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Generic
7878
struct Generic<T> {}
7979
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Generic
80-
// CHECK-NEXT: (normal_conformance type=Generic<T> protocol=P1
81-
// CHECK-NEXT: (assoc_type req=A type=T)
82-
// CHECK-NEXT: (value req=f() witness=main.(file).Generic extension.f()@{{.*}})
80+
// CHECK-NEXT: (normal_conformance type="Generic<T>" protocol="P1"
81+
// CHECK-NEXT: (assoc_type req="A" type="T")
82+
// CHECK-NEXT: (value req="f()" witness="main.(file).Generic extension.f()@{{.*}}")
8383
// CHECK-NEXT: conforms_to: T P1)
8484
extension Generic: P1 where T: P1 {
8585
typealias A = T
@@ -94,11 +94,11 @@ extension Generic: P1 where T: P1 {
9494
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Super
9595
class Super<T, U> {}
9696
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Super
97-
// CHECK-NEXT: (normal_conformance type=Super<T, U> protocol=P2
98-
// CHECK-NEXT: (assoc_type req=A type=T)
99-
// CHECK-NEXT: (assoc_type req=B type=T)
100-
// CHECK-NEXT: (abstract_conformance protocol=P2)
101-
// CHECK-NEXT: (abstract_conformance protocol=P2)
97+
// CHECK-NEXT: (normal_conformance type="Super<T, U>" protocol="P2"
98+
// CHECK-NEXT: (assoc_type req="A" type="T")
99+
// CHECK-NEXT: (assoc_type req="B" type="T")
100+
// CHECK-NEXT: (abstract_conformance protocol="P2")
101+
// CHECK-NEXT: (abstract_conformance protocol="P2")
102102
// CHECK-NEXT: conforms_to: T P2
103103
// CHECK-NEXT: conforms_to: U P2)
104104
extension Super: P2 where T: P2, U: P2 {
@@ -108,29 +108,29 @@ extension Super: P2 where T: P2, U: P2 {
108108

109109
// Inherited/specialized conformances.
110110
// CHECK-LABEL: ClassDecl name=Sub
111-
// CHECK-NEXT: (inherited_conformance type=Sub protocol=P2
112-
// CHECK-NEXT: (specialized_conformance type=Super<NonRecur, Recur> protocol=P2
113-
// CHECK-NEXT: (substitution_map generic_signature=<T, U where T : P2, U : P2>
114-
// CHECK-NEXT: (substitution T -> NonRecur)
115-
// CHECK-NEXT: (substitution U -> Recur)
116-
// CHECK-NEXT: (conformance type=T
117-
// CHECK-NEXT: (normal_conformance type=NonRecur protocol=P2
118-
// CHECK-NEXT: (assoc_type req=A type=Recur)
119-
// CHECK-NEXT: (assoc_type req=B type=Recur)
120-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2
121-
// CHECK-NEXT: (assoc_type req=A type=Recur)
122-
// CHECK-NEXT: (assoc_type req=B type=Recur)
123-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above))
124-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above)))
125-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above))))
126-
// CHECK-NEXT: (conformance type=U
127-
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above))))
128-
// CHECK-NEXT: (conditional requirements unable to be computed)
129-
// CHECK-NEXT: (normal_conformance type=Super<T, U> protocol=P2
130-
// CHECK-NEXT: (assoc_type req=A type=T)
131-
// CHECK-NEXT: (assoc_type req=B type=T)
132-
// CHECK-NEXT: (abstract_conformance protocol=P2)
133-
// CHECK-NEXT: (abstract_conformance protocol=P2)
111+
// CHECK-NEXT: (inherited_conformance type="Sub" protocol="P2"
112+
// CHECK-NEXT: (specialized_conformance type="Super<NonRecur, Recur>" protocol="P2"
113+
// CHECK-NEXT: (substitution_map generic_signature="<T, U where T : P2, U : P2>"
114+
// CHECK-NEXT: (substitution "T -> NonRecur")
115+
// CHECK-NEXT: (substitution "U -> Recur")
116+
// CHECK-NEXT: (conformance type="T"
117+
// CHECK-NEXT: (normal_conformance type="NonRecur" protocol="P2"
118+
// CHECK-NEXT: (assoc_type req="A" type="Recur")
119+
// CHECK-NEXT: (assoc_type req="B" type="Recur")
120+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2"
121+
// CHECK-NEXT: (assoc_type req="A" type="Recur")
122+
// CHECK-NEXT: (assoc_type req="B" type="Recur")
123+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)
124+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
125+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)))
126+
// CHECK-NEXT: (conformance type="U"
127+
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)))
128+
// CHECK-NEXT: (<conditional requirements unable to be computed>)
129+
// CHECK-NEXT: (normal_conformance type="Super<T, U>" protocol="P2"
130+
// CHECK-NEXT: (assoc_type req="A" type="T")
131+
// CHECK-NEXT: (assoc_type req="B" type="T")
132+
// CHECK-NEXT: (abstract_conformance protocol="P2")
133+
// CHECK-NEXT: (abstract_conformance protocol="P2")
134134
// CHECK-NEXT: conforms_to: T P2
135135
// CHECK-NEXT: conforms_to: U P2)))
136136
class Sub: Super<NonRecur, Recur> {}
@@ -139,24 +139,24 @@ class Sub: Super<NonRecur, Recur> {}
139139
// should work through SubstitutionMaps.
140140

141141
// CHECK-LABEL: StructDecl name=RecurGeneric
142-
// CHECK-NEXT: (normal_conformance type=RecurGeneric<T> protocol=P3
143-
// CHECK-NEXT: (assoc_type req=A type=RecurGeneric<T>)
144-
// CHECK-NEXT: (normal_conformance type=RecurGeneric<T> protocol=P3 (details printed above)))
142+
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3"
143+
// CHECK-NEXT: (assoc_type req="A" type="RecurGeneric<T>")
144+
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3" <details printed above>))
145145
struct RecurGeneric<T: P3>: P3 {
146146
typealias A = RecurGeneric<T>
147147
}
148148

149149
// CHECK-LABEL: StructDecl name=Specialize
150-
// CHECK-NEXT: (normal_conformance type=Specialize protocol=P3
151-
// CHECK-NEXT: (assoc_type req=A type=RecurGeneric<Specialize>)
152-
// CHECK-NEXT: (specialized_conformance type=Specialize.A protocol=P3
153-
// CHECK-NEXT: (substitution_map generic_signature=<T where T : P3>
154-
// CHECK-NEXT: (substitution T -> Specialize)
155-
// CHECK-NEXT: (conformance type=T
156-
// CHECK-NEXT: (normal_conformance type=Specialize protocol=P3 (details printed above))))
157-
// CHECK-NEXT: (normal_conformance type=RecurGeneric<T> protocol=P3
158-
// CHECK-NEXT: (assoc_type req=A type=RecurGeneric<T>)
159-
// CHECK-NEXT: (normal_conformance type=RecurGeneric<T> protocol=P3 (details printed above)))))
150+
// CHECK-NEXT: (normal_conformance type="Specialize" protocol="P3"
151+
// CHECK-NEXT: (assoc_type req="A" type="RecurGeneric<Specialize>")
152+
// CHECK-NEXT: (specialized_conformance type="Specialize.A" protocol="P3"
153+
// CHECK-NEXT: (substitution_map generic_signature="<T where T : P3>"
154+
// CHECK-NEXT: (substitution "T -> Specialize")
155+
// CHECK-NEXT: (conformance type="T"
156+
// CHECK-NEXT: (normal_conformance type="Specialize" protocol="P3" <details printed above>)))
157+
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3"
158+
// CHECK-NEXT: (assoc_type req="A" type="RecurGeneric<T>")
159+
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3" <details printed above>))))
160160
struct Specialize: P3 {
161161
typealias A = RecurGeneric<Specialize>
162162
}

test/Frontend/dump-parse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ enum TrailingSemi {
5858
// CHECK-AST-LABEL: (func_decl{{.*}}"generic(_:)" "<T : Hashable>" interface type="<T where T : Hashable> (T) -> ()" access=internal captures=(<generic> )
5959
func generic<T: Hashable>(_: T) {}
6060
// CHECK-AST: (pattern_binding_decl
61-
// CHECK-AST: (processed_init=declref_expr type="(Int) -> ()" location={{.*}} range={{.*}} decl="main.(file).generic@{{.*}} [with (substitution_map generic_signature=<T where T : Hashable> (substitution T -> Int))]" function_ref=unapplied))
61+
// CHECK-AST: (processed_init=declref_expr type="(Int) -> ()" location={{.*}} range={{.*}} decl="main.(file).generic@{{.*}} [with (substitution_map generic_signature='<T where T : Hashable>' 'T -> Int')]" function_ref=unapplied))
6262
let _: (Int) -> () = generic
6363

6464
// Closures should be marked as escaping or not.

0 commit comments

Comments
 (0)