fix: missing mkJpDeclIfNotSimple
This commit is contained in:
parent
31f7c51d14
commit
ea35f6e091
2 changed files with 7 additions and 2 deletions
|
|
@ -186,6 +186,7 @@ partial def visitCases (casesInfo : CasesInfo) (e : Expr) : SimpM Expr := do
|
|||
|
||||
partial def inlineApp (e : Expr) (jp? : Option Expr := none) : SimpM Expr := do
|
||||
let f := e.getAppFn
|
||||
trace[Compiler.simp.inline] "inlining {e}"
|
||||
let value ← match f with
|
||||
| .const declName us =>
|
||||
let some decl ← getStage1Decl? declName | unreachable!
|
||||
|
|
@ -245,6 +246,7 @@ partial def inlineApp? (e : Expr) (xs : Array Expr) (k? : Option Expr) : SimpM (
|
|||
visitLet x (xs.push x)
|
||||
let body ← mkLetUsingScope body
|
||||
mkLambda #[y] body
|
||||
let jp ← mkJpDeclIfNotSimple jp
|
||||
/- Inline `toInline` and "go-to" `jp` with the result. -/
|
||||
inlineApp toInline jp
|
||||
|
||||
|
|
@ -298,6 +300,8 @@ partial def Decl.simp (decl : Decl) : CoreM Decl := do
|
|||
return decl
|
||||
|
||||
builtin_initialize
|
||||
registerTraceClass `Compiler.simp.inline
|
||||
registerTraceClass `Compiler.simp.step
|
||||
registerTraceClass `Compiler.simp.inline.stats
|
||||
|
||||
end Lean.Compiler
|
||||
|
|
@ -36,8 +36,9 @@ private partial def visitLet (e : Expr) (fvars : Array Expr) : CompilerM Expr :=
|
|||
let body ← visitLet body (fvars.push x)
|
||||
let body ← mkLetUsingScope body
|
||||
mkLambda #[x] body
|
||||
value ← attachJp value jp
|
||||
visitCases casesInfo value
|
||||
let jp ← mkJpDeclIfNotSimple jp
|
||||
value ← visitCases casesInfo value
|
||||
attachJp value jp
|
||||
else
|
||||
if value.isLambda then
|
||||
value ← visitLambda value
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue