Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/Lean/Elab/Tactic/Location.lean
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ def withLocation (loc : Location) (atLocal : FVarId → TacticM Unit) (atTarget
if type then
withMainContext atTarget
| Location.wildcard =>
let worked ← tryTactic <| withMainContext <| atTarget
let worked ← tryTactic <| withSaveInfoContext <| withMainContext <| atTarget
let g ← try getMainGoal catch _ => return () -- atTarget closed the goal
g.withContext do
let mut worked := worked
-- We must traverse backwards because the given `atLocal` may use the revert/intro idiom
for fvarId in (← getLCtx).getFVarIds.reverse do
if (← fvarId.getDecl).isImplementationDetail then
continue
worked := worked || (← tryTactic <| withMainContext <| atLocal fvarId)
worked := worked || (← tryTactic <| withSaveInfoContext <| withMainContext <| atLocal fvarId)
unless worked do
failed (← getMainGoal)

Expand Down
9 changes: 9 additions & 0 deletions tests/lean/interactive/10898.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/-!
# `rw .. at *` should save metacontext
-/

example (h : 1 + 2 = 3) : True := by
rewrite [Nat.add_comm _] at *
--^ $/lean/plainGoal
--^ $/lean/plainTermGoal
trivial
9 changes: 9 additions & 0 deletions tests/lean/interactive/10898.lean.expected.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"textDocument": {"uri": "file:///10898.lean"},
"position": {"line": 5, "character": 24}}
{"rendered": "```lean\nh : 2 + 1 = 3\n⊢ True\n```",
"goals": ["h : 2 + 1 = 3\n⊢ True"]}
{"textDocument": {"uri": "file:///10898.lean"},
"position": {"line": 5, "character": 24}}
{"range":
{"start": {"line": 5, "character": 24}, "end": {"line": 5, "character": 25}},
"goal": "h : 1 + 2 = 3\n⊢ Nat"}
Loading