lean4-htt/tests/lean/issue3232.lean
Joachim Breitner 9f6bbfa106
feat: apply’s error message should show implicit arguments as needed (#3929)
luckily the necessary functionality already exists in the form of
`addPPExplicitToExposeDiff`. But it is not cheap, and we should not run
this code
when the error message isn’t shown, so we should do this lazily.

We already had `MessageData.ofPPFormat` to assemble the error message
lazily, but it
was restricted to returning `FormatWithInfo`, a data type that doesn’t
admit a nice
API to compose more complex messages (like `Format` or `MessageData`
has; an attempt to
fix that is in #3926).

Therefore we split the functionality of `.ofPPFormat` into
`.ofFormatWithInfo` and `.ofLazy`,
and use `.ofLazy` to compute the more complex error message of `apply`.

Fixes #3232.

---------

Co-authored-by: David Thrane Christiansen <david@davidchristiansen.dk>
Co-authored-by: Wojciech Nawrocki <wjnawrocki@protonmail.com>
2024-05-18 06:25:43 +00:00

11 lines
349 B
Text

inductive foo {n : Nat} : Prop
-- Check that the error message will print the types with implicit arguments shown
example (h : @foo 42) : @foo 23 := by
apply h
example : (1 : Nat) = 1 := by
apply (rfl : (1 : Int) = 1)
example : PUnit.{0} = PUnit.{0} := by
apply Eq.refl PUnit.{1} -- TODO: addPPExplicitToExposeDiff is not handling this yet