Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/Lean/Elab/SyntheticMVars.lean
Original file line number Diff line number Diff line change
Expand Up @@ -660,16 +660,18 @@ def synthesizeSyntheticMVarsUsingDefault : TermElabM Unit := do
synthesizeUsingDefaultLoop

private partial def withSynthesizeImp (k : TermElabM α) (postpone : PostponeBehavior) : TermElabM α := do
let pendingMVarsSaved := (← get).pendingMVars
modify fun s => { s with pendingMVars := [] }
try
let a ← k
synthesizeSyntheticMVars (postpone := postpone)
if postpone == .yes then
synthesizeUsingDefaultLoop
return a
finally
modify fun s => { s with pendingMVars := s.pendingMVars ++ pendingMVarsSaved }
let pendingMVarsSaved := (← get).pendingMVars
let postponedLevelUnifs ← getResetPostponed
modify fun s => { s with pendingMVars := [] }
try
let a ← k
synthesizeSyntheticMVars (postpone := postpone)
if postpone == .yes then
synthesizeUsingDefaultLoop
return a
finally
modify fun s => { s with pendingMVars := s.pendingMVars ++ pendingMVarsSaved }
modifyPostponed fun newPostponed => postponedLevelUnifs ++ newPostponed

/--
Execute `k`, and synthesize pending synthetic metavariables created while executing `k` are solved.
Expand Down
8 changes: 8 additions & 0 deletions tests/elab/13875.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/-!
Regression test for https://github.com/leanprover/lean4/issues/13785.
-/

example (s : String) (x : Nat) : String :=
let := s.all (·.isAlphanum)
match x with
| _ => s
Loading