lean4-htt/tests/lean/interactive/incrementalMutual.lean
Sebastian Ullrich 8437d1f660
fix: incorrect info tree reuse (#4340)
The `save` happened in a slightly different context from the restore,
which a refinement of the `saveOrRestoreFull` signature now makes
impossible.

Fixes #4328
2024-06-04 09:28:40 +00:00

40 lines
1.3 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/-! Incremental reuse in `mutual` -/
/-! should invalidate body of `b1` only -/
mutual
def b0 : (by dbg_trace "b 0 0"; exact Nat) := (by dbg_trace "b 0 1"; exact 0)
def b1 : (by dbg_trace "b 1 0"; exact Nat) := (by dbg_trace "b 1 1"; exact 0)
--^ sync
--^ insert: ".5"
end
/-! should invalidate both bodies (and, in current impl, second header) -/
-- RESET
mutual
def f0 : (by dbg_trace "f 0 0"; exact Nat) := (by dbg_trace "f 0 1"; exact 0)
--^ sync
--^ insert: ".5"
def f1 : (by dbg_trace "f 1 0"; exact Nat) := (by dbg_trace "f 1 1"; exact 0)
end
/-! should invalidate everything but header of `h0` -/
-- RESET
mutual
def h0 : (by dbg_trace "h 0 0"; exact Nat) := (by dbg_trace "h 0 1"; exact 0)
def h1 : (by dbg_trace "h 1 0"; exact Nat) := (by dbg_trace "h 1 1"; exact 0)
--^ sync
--^ insert: ".5"
end
/-! #4328 incorrect info tree restore led to linter false-positives. -/
-- RESET
def map' {α β} (f : α → β) : List α → List β :=
List.map f
--^ collectDiagnostics
--^ insert: "\n"
--^ collectDiagnostics