This PR improves the “expected type mismatch” error message by omitting the type's types when they are defeq, and putting them into separate lines when not. I found it rather tediuos to parse the error message when the expected type is long, because I had to find the `:` in the middle of a large expression somewhere. Also, when both are of sort `Prop` or `Type` it doesn't add much value to print the sort (and it’s only one hover away anyways).
42 lines
615 B
Text
42 lines
615 B
Text
def f : IO Nat := do
|
||
IO.println "foo"
|
||
return 0
|
||
|
||
abbrev M := StateRefT Nat IO
|
||
|
||
def g (a : Nat) : M Unit :=
|
||
pure ()
|
||
|
||
/--
|
||
info: id do
|
||
let a ← liftM f
|
||
g a : M Unit
|
||
-/
|
||
#guard_msgs in
|
||
#check id (α := M Unit) do let a ← f; g a
|
||
|
||
set_option autoLift false
|
||
|
||
set_option pp.mvars false in
|
||
/--
|
||
info: type mismatch
|
||
f
|
||
has type
|
||
IO Nat
|
||
but is expected to have type
|
||
M ?_
|
||
---
|
||
info: id do
|
||
let a ← sorry
|
||
g a : M Unit
|
||
-/
|
||
#guard_msgs in
|
||
#check_failure id (α := M Unit) do let a ← f; g a
|
||
|
||
/--
|
||
info: id do
|
||
let a ← liftM f
|
||
g a : M Unit
|
||
-/
|
||
#guard_msgs in
|
||
#check id (α := M Unit) do let a ← liftM f; g a
|