fix: Tactic failure on synthesizing placeholder #139

Merged
aniva merged 10 commits from bug/tactic-failure-placeholder into dev 2024-12-11 01:13:15 -08:00
1 changed files with 17 additions and 4 deletions
Showing only changes of commit 1d10cd2b20 - Show all commits

View File

@ -177,12 +177,25 @@ protected def GoalState.getMVarEAssignment (goalState: GoalState) (mvarId: MVarI
--- Tactic execution functions ---
-- Mimics `Elab.Term.logUnassignedUsingErrorInfos`
private def collectAllErroredMVars (src : MVarId) : Elab.TermElabM (List MVarId) := do
let descendants ← Meta.getMVars $ ← instantiateMVars (.mvar src)
(← getThe Elab.Term.State).mvarErrorInfos
|>.map (·.mvarId)
|>.filterM λ mvarId =>
return descendants.contains mvarId ∧ !(← mvarId.isAssignedOrDelayedAssigned)
let mut alreadyVisited : MVarIdSet := {}
let mut result : MVarIdSet := {}
for mvarErrorInfo in (← get).mvarErrorInfos do
let mvarId := mvarErrorInfo.mvarId
unless alreadyVisited.contains mvarId do
alreadyVisited := alreadyVisited.insert mvarId
/- The metavariable `mvarErrorInfo.mvarId` may have been assigned or
delayed assigned to another metavariable that is unassigned. -/
let mvarDeps ← Meta.getMVars (mkMVar mvarId)
if mvarDeps.any descendants.contains then do
result := result.insert mvarId
return result.toList
--(← getThe Elab.Term.State).mvarErrorInfos
-- |>.map (·.mvarId)
-- |>.filterM λ mvarId =>
-- return descendants.contains mvarId ∧ !(← mvarId.isAssignedOrDelayedAssigned)
private def mergeMVarLists (li1 li2 : List MVarId) : List MVarId :=
let li2' := li2.filter (¬ li1.contains ·)