Skip to content

Commit

Permalink
Revert "fix: make sure refine preserves pre-existing natural mvars (#…
Browse files Browse the repository at this point in the history
…2435)"

This reverts commit 0b64c1e.
  • Loading branch information
semorrison committed Aug 30, 2023
1 parent b8084d5 commit acbd503
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 75 deletions.
14 changes: 6 additions & 8 deletions src/Lean/Elab/Tactic/ElabTerm.lean
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,21 @@ where
let newMVarIds ← getMVarsNoDelayed val
/- ignore let-rec auxiliary variables, they are synthesized automatically later -/
let newMVarIds ← newMVarIds.filterM fun mvarId => return !(← Term.isLetRecAuxMVar mvarId)
/- The following `unless … do` block guards against unassigned natural mvarids created during
`k` in the case that `allowNaturalHoles := false`. If we pass this block without aborting, we
can be assured that `newMVarIds` does not contain unassigned natural mvars created during `k`.
Note that in all cases we must allow `newMVarIds` to contain unassigned natural mvars which
were created *before* `k`; this is the purpose of `mvarCounterSaved`, which lets us distinguish
mvars created before `k` from those created during and after. See issue #2434. -/
unless allowNaturalHoles do
let newMVarIds ← if allowNaturalHoles then
pure newMVarIds.toList
else
let naturalMVarIds ← newMVarIds.filterM fun mvarId => return (← mvarId.getKind).isNatural
let syntheticMVarIds ← newMVarIds.filterM fun mvarId => return !(← mvarId.getKind).isNatural
let naturalMVarIds ← filterOldMVars naturalMVarIds mvarCounterSaved
logUnassignedAndAbort naturalMVarIds
pure syntheticMVarIds.toList
/-
We sort the new metavariable ids by index to ensure the new goals are ordered using the order the metavariables have been created.
See issue #1682.
Potential problem: if elaboration of subterms is delayed the order the new metavariables are created may not match the order they
appear in the `.lean` file. We should tell users to prefer tagged goals.
-/
let newMVarIds ← sortMVarIdsByIndex newMVarIds.toList
let newMVarIds ← sortMVarIdsByIndex newMVarIds
tagUntaggedGoals (← getMainTag) tagSuffix newMVarIds
return (val, newMVarIds)

Expand Down
53 changes: 0 additions & 53 deletions tests/lean/refinePreservesNaturalMVars.lean

This file was deleted.

14 changes: 0 additions & 14 deletions tests/lean/refinePreservesNaturalMVars.lean.expected.out

This file was deleted.

0 comments on commit acbd503

Please sign in to comment.