We now (try to) postpone `match ... with` elaboration when pattern variables and patterns still contain metavariables before invoking `mkMatcher`. This improvement makes sure we can elaborate an example submitted by Daniel Selsam. Remark: this update may create performance problems since we backtrack `elabMatchTypeAndDiscrs` and `elabMatchAltView`. We hope this is not a problem in practice since we use the "quick-check" `waitExpectedTypeAndDiscrs`. Recall that we could compile Lean without this commit. So, it suggests cases where we need to postpone after `elabMatchAltView` are rare.
17 lines
450 B
Text
17 lines
450 B
Text
def small (ps : Array (Nat × Nat)) : Array (Nat × Nat) :=
|
||
(ps.filter fun (p : Prod _ _) =>
|
||
match p with
|
||
| (x, y) => x == 0)
|
||
++
|
||
ps
|
||
|
||
#eval small #[(1, 2), (0, 3), (2, 4)]
|
||
|
||
variables {α β : Type} [Inhabited α] [Inhabited β]
|
||
|
||
def P (xys : Array (α × β)) (f : α → β) : Prop := True
|
||
|
||
example (xys : Array (α × β))
|
||
(pred? : α → Bool)
|
||
(H : Subtype $ P (xys.filter fun (x, _) => pred? x))
|
||
: Unit := ()
|