Commit d6b397a
committed
fix: panic in tactic analysis framework (#31472)
The test added in this PR causes a panic on current mathlib, the panic being this one:
https://github.com/leanprover-community/mathlib4/blob/32fb6832e1009174e2787a2cbbc7669399175c61/Mathlib/Lean/ContextInfo.lean#L72
This PR fixes the panic. The issue is in the tactic analysis framework's `terminalReplacement` linter builder. The idea with `terminalReplacement` is to try all `old_tactic` occurrences to see if swapping in `new_tactic` finishes at that point. If `new_tactic` works but doesn't finish it is supposed to print the new goal(s) produced by `new_tactic`; this is the case that was causing the panic.
The issue was that the `MetaM` call(s) to infer the type(s) of the new goal(s) were being routed through the `Lean.Elab.ContextInfo.runTactic` function, which panics if (as will typically be the case) one of these goals represents nontrivial progress from the previous goal state. I have fixed this by storing the types of the new goals at the time they are generated, so we don't need `Lean.Elab.ContextInfo.runTactic` to cook up a new `MetaM` instance.1 parent 05b317a commit d6b397a
File tree
4 files changed
+36
-10
lines changed- MathlibTest
- Mathlib
- Lean
- Tactic
- TacticAnalysis
4 files changed
+36
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | | - | |
87 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
| 54 | + | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 58 | + | |
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
18 | 38 | | |
19 | 39 | | |
20 | 40 | | |
| |||
0 commit comments