File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ import Lean
2+
3+
4+ -- This should not be swallowed by the `try`
5+ /--
6+ warning: Possibly looping simp theorem: `← Nat.add_zero 1`
7+
8+ Hint: You can disable a simp theorem from the default simp set by passing `- theoremName` to `simp`.
9+ ---
10+ error: Tactic `simp` failed with a nested error:
11+ maximum recursion depth has been reached
12+ use `set_option maxRecDepth <num>` to increase limit
13+ use `set_option diagnostics true` to get diagnostic information
14+ -/
15+ #guard_msgs in
16+ set_option maxRecDepth 200 in -- low to make this fast
17+ example : 1 = sorry := by
18+ try simp [← Nat.add_zero 1 ]
19+
20+ open Lean
21+
22+ /--
23+ error: Tactic `foo` failed with a nested error:
24+ maximum recursion depth has been reached
25+ use `set_option maxRecDepth <num>` to increase limit
26+ use `set_option diagnostics true` to get diagnostic information
27+ -/
28+ #guard_msgs in
29+ run_meta show MetaM Unit from do
30+ try
31+ -- Throw a recursion depth error wrapped in a nested error
32+ tryCatchRuntimeEx
33+ (throwMaxRecDepthAt .missing)
34+ (fun e =>
35+ Meta.throwNestedTacticEx `foo e)
36+ catch e =>
37+ -- We didn't use `tryCatchRuntimeEx` here so we shouldn't catch it.
38+ throwError m!"Should not be caught"
You can’t perform that action at this time.
0 commit comments