fix: Use `getMVarsNoDelayed`

This commit is contained in:
Leni Aniva 2024-08-16 00:32:34 -07:00
parent 5b4f8a37eb
commit d17b21e282
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
1 changed files with 2 additions and 9 deletions

View File

@ -4,14 +4,6 @@ open Lean
namespace Pantograph.Tactic namespace Pantograph.Tactic
private def newMVarSet (mctxOld: @&MetavarContext) (mctxNew: @&MetavarContext): SSet MVarId :=
mctxNew.decls.foldl (fun acc mvarId mvarDecl =>
if let .some prevMVarDecl := mctxOld.decls.find? mvarId then
assert! prevMVarDecl.type == mvarDecl.type
acc
else
acc.insert mvarId
) SSet.empty
def assign (goal: MVarId) (expr: Expr): MetaM (List MVarId) := do def assign (goal: MVarId) (expr: Expr): MetaM (List MVarId) := do
goal.checkNotAssigned `Pantograph.Tactic.assign goal.checkNotAssigned `Pantograph.Tactic.assign
@ -21,7 +13,8 @@ def assign (goal: MVarId) (expr: Expr): MetaM (List MVarId) := do
unless ← Meta.isDefEq goalType exprType do unless ← Meta.isDefEq goalType exprType do
throwError s!"{← Meta.ppExpr expr} : {← Meta.ppExpr exprType} ≠ {← Meta.ppExpr goalType}" throwError s!"{← Meta.ppExpr expr} : {← Meta.ppExpr exprType} ≠ {← Meta.ppExpr goalType}"
let nextGoals ← Meta.getMVars expr -- FIXME: Use `withCollectingNewGoalsFrom`. Think about how this interacts with elaboration ...
let nextGoals ← Meta.getMVarsNoDelayed expr
goal.assign expr goal.assign expr
nextGoals.toList.filterM (not <$> ·.isAssigned) nextGoals.toList.filterM (not <$> ·.isAssigned)