lean4-htt/tests/lean/implicit_after_auto_param_bug.lean
Leonardo de Moura d88a6f663e fix(frontends/lean/elaborator): implicit arguments after auto_param arguments
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.
2017-11-14 17:22:12 -08:00

33 lines
670 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)