Skip to content

Commit dde45bc

Browse files
committed
More test cases
1 parent 4f554b0 commit dde45bc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/lean/run/match1.lean

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,27 @@ match n, parity n with
162162
| _, Parity.even j => false :: natToBin j
163163
| _, Parity.odd j => true :: natToBin j
164164

165+
-- Even with sparse matching, this can break
166+
167+
/--
168+
error: Tactic `cases` failed with a nested error:
169+
Dependent elimination failed: Failed to solve equation
170+
n✝¹.succ = n✝.add n✝
171+
at case `Parity.even` after processing
172+
(Nat.succ _), _
173+
the dependent pattern matcher can solve the following kinds of equations
174+
- <var> = <term> and <term> = <var>
175+
- <term> = <term> where the terms are definitionally equal
176+
- <constructor> = <constructor>, examples: List.cons x xs = List.cons y ys, and List.cons x xs = List.nil
177+
-/
178+
#guard_msgs in
179+
partial def natToBinBad2 (n : Nat) : List Bool :=
180+
match n, parity n with
181+
| 0, _ => []
182+
| .succ 0, _ => [true]
183+
| _, Parity.even j => false :: natToBin j
184+
| _, Parity.odd j => true :: natToBin j
185+
165186
partial def natToBin2 (n : Nat) : List Bool :=
166187
match n, parity n with
167188
| _, Parity.even 0 => []

0 commit comments

Comments
 (0)