This PR changes the implementation of `trace.Compiler.result` to use the decls as they are provided rather than looking them up in the LCNF mono environment extension, which was seemingly done to save the trouble of re-normalizing fvar IDs before printing the decl. This means that the `._closed` decls created by the `extractClosed` pass will now be included in the output, which was definitely confusing before if you didn't know what was happening.
56 lines
1.7 KiB
Text
56 lines
1.7 KiB
Text
import Lean
|
|
|
|
inductive MyEmpty
|
|
|
|
def f (x : MyEmpty) : Nat :=
|
|
MyEmpty.casesOn _ x
|
|
|
|
set_option trace.Compiler.result true
|
|
/--
|
|
trace: [Compiler.result] size: 0
|
|
def f x : Nat :=
|
|
⊥
|
|
---
|
|
trace: [Compiler.result] size: 5
|
|
def _eval._lam_0 _x.1 _x.2 _y.3 _y.4 _y.5 _y.6 _y.7 _y.8 _y.9 : EStateM.Result Lean.Exception PUnit PUnit :=
|
|
let _x.10 := Lean.Compiler.compile _x.1 _y.7 _y.8 _y.9;
|
|
cases _x.10 : EStateM.Result Lean.Exception PUnit PUnit
|
|
| EStateM.Result.ok a.11 a.12 =>
|
|
let _x.13 := EStateM.Result.ok _ _ _ _x.2 a.12;
|
|
return _x.13
|
|
| EStateM.Result.error a.14 a.15 =>
|
|
return _x.10
|
|
[Compiler.result] size: 1
|
|
def _eval._closed_0 : String :=
|
|
let _x.1 := "f";
|
|
return _x.1
|
|
[Compiler.result] size: 2
|
|
def _eval._closed_1 : Lean.Name :=
|
|
let _x.1 := _eval._closed_0;
|
|
let _x.2 := Lean.Name.mkStr1 _x.1;
|
|
return _x.2
|
|
[Compiler.result] size: 2
|
|
def _eval._closed_2 : Array Lean.Name :=
|
|
let _x.1 := 1;
|
|
let _x.2 := Array.mkEmpty ◾ _x.1;
|
|
return _x.2
|
|
[Compiler.result] size: 3
|
|
def _eval._closed_3 : Array Lean.Name :=
|
|
let _x.1 := _eval._closed_1;
|
|
let _x.2 := _eval._closed_2;
|
|
let _x.3 := Array.push ◾ _x.2 _x.1;
|
|
return _x.3
|
|
[Compiler.result] size: 8
|
|
def _eval a.1 a.2 a.3 : EStateM.Result Lean.Exception PUnit PUnit :=
|
|
let _x.4 := _eval._closed_0;
|
|
let _x.5 := _eval._closed_1;
|
|
let _x.6 := 1;
|
|
let _x.7 := _eval._closed_2;
|
|
let _x.8 := _eval._closed_3;
|
|
let _x.9 := PUnit.unit;
|
|
let _f.10 := _eval._lam_0 _x.8 _x.9;
|
|
let _x.11 := Lean.Elab.Command.liftTermElabM._redArg _f.10 a.1 a.2 a.3;
|
|
return _x.11
|
|
-/
|
|
#guard_msgs in
|
|
run_meta Lean.Compiler.compile #[``f]
|