lean4-htt/tests/elab/matchMissingCase.lean
Joachim Breitner e57d84bba0
fix: show missing match cases in declaration order (#13266)
This PR changes the counter-example accumulator in the match compiler
from
a `List` (built with cons, producing reverse order) to an `Array` (built
with push, preserving declaration order). Missing cases are now reported
in
the order constructors appear in the inductive type definition.

For example, given `inductive Enum | a | b | c | d`, missing cases `c`
and
`d` were previously shown as `d, c` and are now shown as `c, d`.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 13:33:54 +00:00

39 lines
548 B
Text

inductive Enum where | a | b | c | d
/--
error: Missing cases:
Enum.c
Enum.d
-/
#guard_msgs in
def test : Enum → Nat
| .a => 0
| .b => 0
/--
error: Missing cases:
_, false
-/
#guard_msgs in
def test2 : Enum → Bool → Nat
| .a, _ => 0
| _, true => 0
/--
error: Missing cases:
(some _), false
-/
#guard_msgs in
def test3 : Option Enum → Bool → Nat
| none, _ => 0
| some .a, _ => 0
| some _, true => 0
/--
error: Missing cases:
_, false
-/
#guard_msgs in
def test4 : String → Bool → Nat
| "a", _ => 0
| _, true => 0