lean4-htt/tests/lean/run/4888.lean
jrr6 995fa4766b
fix: reduce ambiguity of "final" in application type mismatch message (#8322)
This PR refines the new wording of the "application type mismatch" error
message to avoid ambiguity in references to the "final" argument in a
subexpression that may be followed by additional arguments.

It does so by replacing "final" with "last," rephrasing the message so
that this adjective modifies the argument itself rather than the word
"argument," and only displaying this wording when two arguments could be
confused (determined by expression equality).

These changes were motivated by a report that in cases where a function
application `f a b c` fails to elaborate because `b` is incorrectly
typed, the existing error message's reference to `b` being the "final"
argument in the application `f a b` may create confusion because it is
not the final argument in the full application expression.
2025-05-14 16:12:10 +00:00

51 lines
1.9 KiB
Text

/-!
# `all_goals` should not consume error messages
https://github.com/leanprover/lean4/issues/4888
-/
/--
error: Application type mismatch: In the application
Nat.succ True
the argument
True
has type
Prop : Type
but is expected to have type
Nat : Type
-/
#guard_msgs in
theorem bug: True := by
all_goals exact Nat.succ True
trace "Did not get here"
/-!
Regression test: `all_goals` should admit goals rather than leaving metavariables.
-/
/--
error: omega could not prove the goal:
No usable constraints found. You may need to unfold definitions so `omega` can see linear arithmetic facts about `Nat` and `Int`, which may also involve multiplication, division, and modular remainder by constants.
---
error: omega could not prove the goal:
No usable constraints found. You may need to unfold definitions so `omega` can see linear arithmetic facts about `Nat` and `Int`, which may also involve multiplication, division, and modular remainder by constants.
---
error: omega could not prove the goal:
No usable constraints found. You may need to unfold definitions so `omega` can see linear arithmetic facts about `Nat` and `Int`, which may also involve multiplication, division, and modular remainder by constants.
---
error: omega could not prove the goal:
No usable constraints found. You may need to unfold definitions so `omega` can see linear arithmetic facts about `Nat` and `Int`, which may also involve multiplication, division, and modular remainder by constants.
-/
#guard_msgs in
theorem kernel_declaration_meta_variables (x y z : Option Int) : (x = y) ↔ (x = z) := by
apply Iff.elim
all_goals omega
trace "Did not get here"
/-!
Regression test: `all_goals` still respects recovery state.
-/
/-- warning: declaration uses 'sorry' -/
#guard_msgs in
example (x y z : Option Int) : (x = y) ↔ (x = z) := by
apply Iff.elim
first | all_goals omega | all_goals sorry