lean4-htt/tests/lean/interactive/2881.lean
Kyle Miller 5d54b0b13f
fix: erroneous "no goals" in empty tactic list in induction/cases and other tactic info improvements (#9553)
This PR fixes a bug introduced in #7830 where if the cursor is at the
indicated position
```lean
example (as bs : List Nat) : (as.append bs).length = as.length + bs.length := by
  induction as with
  | nil => -- cursor
  | cons b bs ih =>
```
then the Infoview would show "no goals" rather than the `nil` goal. The
PR also fixes a separate bug where placing the cursor on the next line
after the `induction`/`cases` tactics like in
```lean
  induction as with
  | nil => sorry
  | cons b bs ih => sorry
  I -- < cursor
```
would report the original goal in the goal list. Furthermore, there are
numerous improvements to error recovery (including `allGoals`-type logic
for pre-tactics) and the visible tactic states when there are errors.
Adds `Tactic.throwOrLogErrorAt`/`Tactic.throwOrLogError` for throwing or
logging errors depending on the recovery state.
2025-07-26 23:15:31 +00:00

49 lines
943 B
Text

example (n : Nat) : True := by
induction n
case zero => sorry -- `zero` goal
--^ $/lean/plainGoal
example (n : Nat) : True := by
induction n
case zero => sorry
-- `succ` goal
--^ $/lean/plainGoal
example (n : Nat) : True := by
induction n
case' zero => sorry -- `zero` goal
--^ $/lean/plainGoal
example (n : Nat) : True := by
induction n
case' zero => sorry
-- `succ` goal
--^ $/lean/plainGoal
example (n : Nat) : True := by
induction n
next => sorry -- `zero` goal
--^ $/lean/plainGoal
example (n : Nat) : True := by
induction n
next => sorry
-- `succ` goal
--^ $/lean/plainGoal
example (n : Nat) : True := by
induction n with
| zero => sorry -- `zero` goal
--^ $/lean/plainGoal
example (n : Nat) : True := by
induction n with
| zero => sorry
-- No goals
--^ $/lean/plainGoal
example : True := by
suffices True by
-- Goal assuming `True`
--^ $/lean/plainGoal
sorry