Skip to content

Commit 6e0e494

Browse files
committed
Add test
1 parent 008ca15 commit 6e0e494

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/lean/run/7811.lean

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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"

0 commit comments

Comments
 (0)