Skip to content

Commit 549a97f

Browse files
committed
Add a test
1 parent 68ff1ee commit 549a97f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/lean/run/issue10876.lean

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
inductive HasUnitParam where
2+
| yes : Unit → HasUnitParam
3+
| no : HasUnitParam
4+
5+
def foo (x : HasUnitParam) : Bool := x.casesOn (fun _ => true) false
6+
def bar (x : HasUnitParam) : Bool := match x with
7+
| HasUnitParam.yes _x => true
8+
| HasUnitParam.no => false
9+
10+
-- Checks that the delaboration of `casesOn` does not confuse genuine unit fields with
11+
-- the thunking parameter of a genuine matcher
12+
13+
/--
14+
info: def foo : HasUnitParam → Bool :=
15+
fun x =>
16+
match x with
17+
| HasUnitParam.yes x => true
18+
| HasUnitParam.no => false
19+
-/
20+
#guard_msgs in
21+
#print foo
22+
23+
/--
24+
info: def bar : HasUnitParam → Bool :=
25+
fun x =>
26+
match x with
27+
| HasUnitParam.yes _x => true
28+
| HasUnitParam.no => false
29+
-/
30+
#guard_msgs in
31+
#print bar

0 commit comments

Comments
 (0)