Skip to content

Commit 7ed3763

Browse files
author
Amritpan Kaur
committed
Update Type Checker output example.
1 parent e8b840c commit 7ed3763

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

docs/DebuggingTheCompiler.md

+35-33
Original file line numberDiff line numberDiff line change
@@ -163,47 +163,49 @@ This will cause the typechecker to log its internal state as it solves
163163
constraints and present the final type checked solution, e.g.:
164164

165165
```
166-
---Constraint solving for the expression at [test.swift:3:10 - line:3:10]---
166+
---Constraint solving at [test.swift:3:1 - line:3:1]---
167167
---Initial constraints for the given expression---
168-
(integer_literal_expr type='$T0' location=test.swift:3:10 range=[test.swift:3:10 - line:3:10] value=0)
169-
Score: 0 0 0 0 0 0 0 0 0 0 0 0 0
170-
Contextual Type: Int
171-
Type Variables:
172-
#0 = $T0 [inout allowed]
168+
(integer_literal_expr type='$T0' location=test.swift:3:1 range=[test.swift:3:1 - line:3:1] value=0 builtin_initializer=**NULL** initializer=**NULL**)
173169
174-
Active Constraints:
170+
Score: <default 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>
171+
Type Variables:
172+
($T0 [attributes: [literal: integer]] [with possible bindings: (default type of literal) Int]) @ locator@0x13e009800 [IntegerLiteral@test.swift:3:1]
175173
176174
Inactive Constraints:
177-
$T0 literal conforms to ExpressibleByIntegerLiteral [[locator@0x7ffa3a865a00 [IntegerLiteral@test.swift:3:10]]];
178-
$T0 conv Int [[locator@0x7ffa3a865a00 [IntegerLiteral@test.swift:3:10]]];
179-
($T0 literal=3 bindings=(subtypes of) (default from ExpressibleByIntegerLiteral) Int)
180-
Active bindings: $T0 := Int
181-
(trying $T0 := Int
182-
(found solution 0 0 0 0 0 0 0 0 0 0 0 0 0)
183-
)
175+
$T0 literal conforms to ExpressibleByIntegerLiteral [[locator@0x13e009800 [IntegerLiteral@test.swift:3:1]]];
176+
177+
(Potential Binding(s):
178+
($T0 [attributes: [literal: integer]] [with possible bindings: (default type of literal) Int])
179+
(attempting type variable $T0 := Int
180+
(considering -> $T0 literal conforms to ExpressibleByIntegerLiteral [[locator@0x13e009800 [IntegerLiteral@test.swift:3:1]]];
181+
(simplification result:
182+
(removed constraint: $T0 literal conforms to ExpressibleByIntegerLiteral [[locator@0x13e009800 [IntegerLiteral@test.swift:3:1]]];)
183+
)
184+
(outcome: simplified)
185+
)
186+
(Changes:
187+
(Newly Bound:
188+
> $T0 := Int
189+
)
190+
(Removed Constraint:
191+
> $T0 literal conforms to ExpressibleByIntegerLiteral [[locator@0x13e009800 [IntegerLiteral@test.swift:3:1]]];
192+
)
193+
)
194+
(found solution: <default 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>)
195+
)
196+
197+
---Solver statistics---
198+
Total number of scopes explored: 2
199+
Maximum depth reached while exploring solutions: 2
200+
Time: 2.164000e+00ms
201+
184202
---Solution---
185-
Fixed score: 0 0 0 0 0 0 0 0 0 0 0 0 0
203+
Fixed score: <default 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>
186204
Type variables:
187-
$T0 as Int
188-
189-
Overload choices:
190-
191-
Constraint restrictions:
192-
193-
Disjunction choices:
205+
$T0 as Int @ locator@0x13e009800 [IntegerLiteral@test.swift:3:1]
194206
195-
Conformances:
196-
At locator@0x7ffa3a865a00 [IntegerLiteral@test.swift:3:10]
197-
(normal_conformance type=Int protocol=ExpressibleByIntegerLiteral lazy
198-
(normal_conformance type=Int protocol=_ExpressibleByBuiltinIntegerLiteral lazy))
199-
(found solution 0 0 0 0 0 0 0 0 0 0 0 0 0)
200207
---Type-checked expression---
201-
(call_expr implicit type='Int' location=test.swift:3:10 range=[test.swift:3:10 - line:3:10] arg_labels=_builtinIntegerLiteral:
202-
(constructor_ref_call_expr implicit type='(_MaxBuiltinIntegerType) -> Int' location=test.swift:3:10 range=[test.swift:3:10 - line:3:10]
203-
(declref_expr implicit type='(Int.Type) -> (_MaxBuiltinIntegerType) -> Int' location=test.swift:3:10 range=[test.swift:3:10 - line:3:10] decl=Swift.(file).Int.init(_builtinIntegerLiteral:) function_ref=single)
204-
(type_expr implicit type='Int.Type' location=test.swift:3:10 range=[test.swift:3:10 - line:3:10] typerepr='Int'))
205-
(tuple_expr implicit type='(_builtinIntegerLiteral: Int2048)' location=test.swift:3:10 range=[test.swift:3:10 - line:3:10] names=_builtinIntegerLiteral
206-
(integer_literal_expr type='Int2048' location=test.swift:3:10 range=[test.swift:3:10 - line:3:10] value=0)))
208+
(integer_literal_expr type='Int' location=test.swift:3:1 range=[test.swift:3:1 - line:3:1] value=0 builtin_initializer=Swift.(file).Int.init(_builtinIntegerLiteral:) initializer=**NULL**)
207209
```
208210

209211
When using swift LLDB REPL, one can dump the same output for each

0 commit comments

Comments
 (0)