lean4-htt/tests/lean/run/kernelBacktrack.lean
Sebastian Ullrich ca1315e3ba
fix: backtracking kernel errors under Elab.async (#10438)
This PR fixes an issue where notations and other overloadings would
signal kernel errors even though there exists a successful
interpretation.
2025-09-18 12:33:57 +00:00

21 lines
728 B
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.

/-! Kernel errors (via `Lean.Core.State.snapshotTasks`) should be backtracked. -/
structure Wrapper (α) where val : α
instance {α : Type} [NatCast α] : NatCast (Wrapper α) := sorry
def foo {α : Type} (μ : Wrapper α) (f : α → Nat) : Nat := sorry
macro:max P:term noWs "[" term "]" : term => `(foo $P fun x => 0)
/-! This used to give a kernel error even though there is a succeeding interpretation. -/
/-- warning: declaration uses 'sorry' -/
#guard_msgs in
theorem kernel_error
(L : List Nat) (hL : L.length = 2 ∧ ∀ i : Fin L.length, L[i] = 0) (i : Nat) :
L[i % 2] = 0 := sorry
/-- info: 'kernel_error' depends on axioms: [propext, sorryAx, Quot.sound] -/
#guard_msgs in
#print axioms kernel_error