lean4-htt/tests/lean/run/5993.lean
Marc Huisinga 9d427fdfcf
feat: "try this" messages with support for interactivity (#10524)
This PR adds support for interactivity to the combined "try this"
messages that were introduced in #9966. In doing so, it moves the link
to apply a suggestion to a separate `[apply]` button in front of the
suggestion. Hints with diffs remain unchanged, as they did not
previously support interacting with terms in the diff, either.

<img width="379" height="256" alt="Suggestion with interactive message"
src="https://github.com/user-attachments/assets/7838ebf6-0613-46e7-bc88-468a05acbf51"
/>
2025-10-13 13:39:03 +00:00

39 lines
969 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.

/-!
# Avoid delaborating with field notation if object is a metavariable application.
https://github.com/leanprover/lean4/issues/5993
-/
set_option pp.mvars false
/-!
No field notation notation here. Used to print `refine ?_.succ` and `refine ?_.snd`.
-/
/--
info: Try this:
[apply] refine Nat.succ ?_
---
info: found a partial proof, but the corresponding tactic failed:
(expose_names; refine Prod.snd ?_)
It may be possible to correct this proof by adding type annotations, explicitly specifying implicit arguments, or eliminating unnecessary function abstractions.
-/
#guard_msgs in
example : Nat := by
show_term refine Nat.succ ?_
show_term refine Prod.snd (α := Int) ?_
exact default
/-!
No field notation even under binders. (That is, be aware of delayed assignment metavariables.)
-/
/--
info: Try this:
[apply] refine fun x => Nat.succ ?_
-/
#guard_msgs in
example : Nat → Nat := by
show_term refine fun _ => Nat.succ ?_
exact default