@@ -124,23 +124,21 @@ where
124124 let newMVarIds ← getMVarsNoDelayed val
125125 /- ignore let-rec auxiliary variables, they are synthesized automatically later -/
126126 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
134130 let naturalMVarIds ← newMVarIds.filterM fun mvarId => return (← mvarId.getKind).isNatural
131+ let syntheticMVarIds ← newMVarIds.filterM fun mvarId => return !(← mvarId.getKind).isNatural
135132 let naturalMVarIds ← filterOldMVars naturalMVarIds mvarCounterSaved
136133 logUnassignedAndAbort naturalMVarIds
134+ pure syntheticMVarIds.toList
137135 /-
138136 We sort the new metavariable ids by index to ensure the new goals are ordered using the order the metavariables have been created.
139137 See issue #1682.
140138 Potential problem: if elaboration of subterms is delayed the order the new metavariables are created may not match the order they
141139 appear in the `.lean` file. We should tell users to prefer tagged goals.
142140 -/
143- let newMVarIds ← sortMVarIdsByIndex newMVarIds.toList
141+ let newMVarIds ← sortMVarIdsByIndex newMVarIds
144142 tagUntaggedGoals (← getMainTag) tagSuffix newMVarIds
145143 return (val, newMVarIds)
146144
0 commit comments