lean4-htt/tests/server_interactive/incrementalMutual.lean
Garmelon a3cb39eac9
chore: migrate more tests to new test suite (#12809)
This PR migrates most remaining tests to the new test suite. It also
completes the migration of directories like `tests/lean/run`, meaning
that PRs trying to add tests to those old directories will now fail.
2026-03-06 16:52:01 +00:00

78 lines
2.1 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
/-! Reuse should work through the namespaced decl macro. -/
-- RESET
def ns.n : (by dbg_trace "ns 0"; exact Nat) := by
dbg_trace "ns 1"
--^ sync
--^ insert: ".5"
exact 0
/-! Changing the namespace should prohibit def reuse. -/
-- RESET
def nt.n : (by dbg_trace "nt 0"; exact Nat) := by
--^ sync
--^ change: "t" "u"
dbg_trace "nt 1"
exact 0
/-! Reuse should support `in`. -/
-- RESET
set_option trace.Elab.definition.body true in
def so : Nat := by
dbg_trace "so 0"
dbg_trace "so 1"
--^ sync
--^ insert: ".5"
exact 0
/-!
Incomplete syntax should not suppress errors in previous definitions as that would prevent reuse.
-/
-- RESET
mutual
def e0 : Nat := doesNotExist
def e1 : Nat := doesNotExist
en
--^ sync
--^ insert: "d"
--^ collectDiagnostics