Function applications `(f ...)` were not being elaborated correctly when `f` has implicit parameters occurring after auto_params. The new test exposes the problem. This bug was found when developing the red black tree module. This commit also fixes the following bugs: - Invoke type class resolution again after tactic execution at synthesize method. Reason: metavariables occurring in type class instances may have been synthesized by tactics. - mctx.assign optimization at invoke_tactic was incorrect when the metavariable was assigned by typing rules.
33 lines
670 B
Text
33 lines
670 B
Text
meta def default_f_lt := `[apply has_lt.lt]
|
||
|
||
def f (α : Type) (lt : α → α → Prop . default_f_lt) [decidable_rel lt] : Type :=
|
||
α
|
||
|
||
example : id (f nat) = nat :=
|
||
rfl
|
||
|
||
example : f nat = nat :=
|
||
rfl
|
||
|
||
def mk {α : Type} (a : α) (lt : α → α → Prop . default_f_lt) [decidable_rel lt] : f α lt :=
|
||
a
|
||
|
||
def f.to_val {α : Type} {lt : α → α → Prop} {h : decidable_rel lt} (v : @f α lt h) : α :=
|
||
v
|
||
|
||
instance repr_f (α : Type) (lt : α → α → Prop) (d : decidable_rel lt) [has_repr α] : has_repr (@f α lt d) :=
|
||
⟨λ a : α, repr a⟩
|
||
|
||
#check f nat
|
||
|
||
#check id (f nat)
|
||
|
||
#check mk 1
|
||
|
||
#check (mk 1).to_val
|
||
|
||
#eval f.to_val (mk 1)
|
||
|
||
#eval mk 1
|
||
|
||
#eval id (mk 1)
|