lean4-htt/tests/lean/run/439.lean
Leonardo de Moura 6080e3dd5c
fix: enforce isDefEqStuckEx at unstuckMVar procedure (#4596)
Closes #2736

See comment at `ExprDefEq.lean` for explanation.
Side effects:
- Improved error messages in two tests.
- Had to improve `getSuccesses` procedure at `App.lean`. It now
  discards candidates that contain postponed elaboration problems.
  If it is too disruptive for Mathlib, we should try to discard the
  ones that have postponed metavariables.
2024-07-02 13:42:47 +00:00

53 lines
940 B
Text

universe u
structure Fn (E I : Sort u) := (exp : E) (imp : I)
instance (E I : Sort u) : CoeFun (Fn E I) (fun _ => I) := {coe := fun K => K.imp}
class Bar.{w} (P : Sort u) :=
fn : P -> Sort w
variable {P : Sort u} (B : Bar P)
variable (fn : Fn ((p : P) -> B.fn p) ({p : P} -> B.fn p))
#check (@fn : {p : P} → Bar.fn p) -- Result is as expected (implicit)
/-
fn.imp : {p : P} → Bar.fn p
-/
variable (p : P)
variable (Bp : Bar.fn p)
/--
error: function expected at
fn.imp
term has type
Bar.fn ?m.744
-/
#guard_msgs in
#check fn Bp
/--
error: function expected at
fn.imp
term has type
Bar.fn ?m.828
-/
#guard_msgs in
#check fn p
#check fn (p := p)
variable (fn' : Fn ((p : P) -> B.fn p -> B.fn p) ({p : P} -> B.fn p -> B.fn p))
#check fn' Bp
/--
error: application type mismatch
fn'.imp p
argument
p
has type
P : Sort u
but is expected to have type
Bar.fn ?m.1225 : Sort ?u.1170
-/
#guard_msgs in
#check fn' p