@@ -124,23 +124,21 @@ where
124
124
let newMVarIds ← getMVarsNoDelayed val
125
125
/- ignore let-rec auxiliary variables, they are synthesized automatically later -/
126
126
let newMVarIds ← newMVarIds.filterM fun mvarId => return !(← Term.isLetRecAuxMVar mvarId)
127
- /- The following `unless … do` block guards against unassigned natural mvarids created during
128
- `k` in the case that `allowNaturalHoles := false`. If we pass this block without aborting, we
129
- can be assured that `newMVarIds` does not contain unassigned natural mvars created during `k`.
130
- Note that in all cases we must allow `newMVarIds` to contain unassigned natural mvars which
131
- were created *before* `k`; this is the purpose of `mvarCounterSaved`, which lets us distinguish
132
- mvars created before `k` from those created during and after. See issue #2434. -/
133
- unless allowNaturalHoles do
127
+ let newMVarIds ← if allowNaturalHoles then
128
+ pure newMVarIds.toList
129
+ else
134
130
let naturalMVarIds ← newMVarIds.filterM fun mvarId => return (← mvarId.getKind).isNatural
131
+ let syntheticMVarIds ← newMVarIds.filterM fun mvarId => return !(← mvarId.getKind).isNatural
135
132
let naturalMVarIds ← filterOldMVars naturalMVarIds mvarCounterSaved
136
133
logUnassignedAndAbort naturalMVarIds
134
+ pure syntheticMVarIds.toList
137
135
/-
138
136
We sort the new metavariable ids by index to ensure the new goals are ordered using the order the metavariables have been created.
139
137
See issue #1682.
140
138
Potential problem: if elaboration of subterms is delayed the order the new metavariables are created may not match the order they
141
139
appear in the `.lean` file. We should tell users to prefer tagged goals.
142
140
-/
143
- let newMVarIds ← sortMVarIdsByIndex newMVarIds.toList
141
+ let newMVarIds ← sortMVarIdsByIndex newMVarIds
144
142
tagUntaggedGoals (← getMainTag) tagSuffix newMVarIds
145
143
return (val, newMVarIds)
146
144
0 commit comments