Closes #3706
This derive handler's implementation is very similar to `BEq`'s, which
already ignores unused alternative so as to work correctly on indexed
inductive types. This PR simply implements the same solution as the one
present in
[`BEq.lean`](2c15cdda04/src/Lean/Elab/Deriving/BEq.lean (L94)).
After some tests, it doesn't seem like any other derive handler present
in Core suffers from the same issue (though some handlers don't work on
indexed inductives for other reasons).
13 lines
324 B
Text
13 lines
324 B
Text
/--Ensure that `deriving Ord` works on indexed inductive types.-/
|
||
inductive Ty where
|
||
| int
|
||
| bool
|
||
inductive Expr : Ty → Type where
|
||
| a : Expr .int
|
||
| b : Expr .bool
|
||
deriving Ord
|
||
|
||
inductive Vec (α : Type u) : Nat → Type u
|
||
| nil : Vec α 0
|
||
| cons : α → {n : Nat} → Vec α n → Vec α (n+1)
|
||
deriving Ord
|