Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Lean/Elab/Tactic/Try.lean
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ def withOriginalHeartbeats (x : TryTacticM α) : TryTacticM α := do
(fun ex => do
if Exception.isMaxHeartbeat ex then
throwError "tactic exceeded heartbeat limit"
else if ex.isMaxRecDepth then
throwError "tactic exceeded recursion depth limit"
else
throw ex)

Expand Down
9 changes: 9 additions & 0 deletions tests/elab/try_eval_suggest.lean
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ example (h : 1 = 1) : 1 = 1 := by
#guard_msgs (info) in
example : 1 = 1 := by
try? (max := 1) => attempt_all | rfl | simp_all

-- A resource-limit error in one branch should not prevent other branches from producing suggestions.
/--
info: Try this:
[apply] grind
-/
#guard_msgs (substring := true) in
example (f : Nat → Nat) (x : Nat) (h : x = f x) : x = f (f x) := by
try?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this test more reliable by using try? => and a tactic that definitely triggers or explicitly throws maxrecdepth

Loading