fix: Second miss-handling of free variables

main
Henrik Böving 2023-10-17 21:32:48 +02:00
parent bc9cba13b1
commit 0f1b99c1c1
1 changed files with 7 additions and 7 deletions

View File

@ -12,12 +12,13 @@ namespace DocGen4.Process
open Lean Meta Widget open Lean Meta Widget
partial def stripArgs (e : Expr) : Expr := partial def stripArgs (e : Expr) (k : Expr → MetaM α) : MetaM α :=
match e.consumeMData with match e.consumeMData with
| Expr.forallE name _ body _ => | Expr.forallE name type body bi =>
let name := name.eraseMacroScopes let name := name.eraseMacroScopes
stripArgs (Expr.instantiate1 body (mkFVar ⟨name⟩)) Meta.withLocalDecl name bi type fun fvar => do
| _ => e stripArgs (Expr.instantiate1 body fvar) k
| _ => k e
def valueToEq (v : DefinitionVal) : MetaM Expr := withLCtx {} {} do def valueToEq (v : DefinitionVal) : MetaM Expr := withLCtx {} {} do
withOptions (tactic.hygienic.set . false) do withOptions (tactic.hygienic.set . false) do
@ -29,8 +30,7 @@ def valueToEq (v : DefinitionVal) : MetaM Expr := withLCtx {} {} do
def processEq (eq : Name) : MetaM CodeWithInfos := do def processEq (eq : Name) : MetaM CodeWithInfos := do
let type ← (mkConstWithFreshMVarLevels eq >>= inferType) let type ← (mkConstWithFreshMVarLevels eq >>= inferType)
let final := stripArgs type stripArgs type prettyPrintTerm
prettyPrintTerm final
def DefinitionInfo.ofDefinitionVal (v : DefinitionVal) : MetaM DefinitionInfo := do def DefinitionInfo.ofDefinitionVal (v : DefinitionVal) : MetaM DefinitionInfo := do
let info ← Info.ofConstantVal v.toConstantVal let info ← Info.ofConstantVal v.toConstantVal
@ -49,7 +49,7 @@ def DefinitionInfo.ofDefinitionVal (v : DefinitionVal) : MetaM DefinitionInfo :=
isNonComputable isNonComputable
} }
| none => | none =>
let equations := #[← prettyPrintTerm <| stripArgs (← valueToEq v)] let equations := #[← stripArgs (← valueToEq v) prettyPrintTerm]
return { return {
toInfo := info, toInfo := info,
isUnsafe, isUnsafe,