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>
39 lines
548 B
Text
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
|