fix(repl): Allow .none in parentExpr

This commit is contained in:
Leni Aniva 2025-06-30 15:08:46 -07:00
parent dd7c6c36c8
commit 3fab7e7818
Signed by: aniva
GPG Key ID: D5F96287843E8DFB
3 changed files with 5 additions and 4 deletions

View File

@ -132,8 +132,9 @@ def goalPrint (state: GoalState) (rootExpr: Bool) (parentExprs: Bool) (goals: Bo
pure .none
let parentExprs? ← if parentExprs then
.some <$> state.parentMVars.mapM λ parent => parent.withContext do
let val := state.getMVarEAssignment parent |>.get!
serializeExpression options (← instantiateAll val)
let val? := state.getMVarEAssignment parent
val?.mapM λ val => do
serializeExpression options (← instantiateAll val)
else
pure .none
let goals ← if goals then

View File

@ -325,7 +325,7 @@ structure GoalPrintResult where
-- The root expression
root?: Option Expression := .none
-- The filling expression of the parent goal
parentExprs?: Option (List Expression) := .none
parentExprs?: Option (List (Option Expression)) := .none
goals: Array Goal := #[]
extraMVars: Array Expression := #[]

View File

@ -91,7 +91,7 @@ def test_tactic : Test := do
step "goal.print" ({ stateId := 1, parentExprs? := .some true, rootExpr? := .some true }: Protocol.GoalPrint)
({
root? := .some { pp? := "fun x => ?m.11"},
parentExprs? := .some [{ pp? := .some "fun x => ?m.11" }],
parentExprs? := .some [.some { pp? := .some "fun x => ?m.11" }],
}: Protocol.GoalPrintResult)
step "goal.tactic" ({ stateId := 1, tactic? := .some "intro y" }: Protocol.GoalTactic)
({ nextStateId? := .some 2, goals? := #[goal2], }: Protocol.GoalTacticResult)