Cases on mvar leading to crash/stackoverflow
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Prerequisites
- Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
example : ∃ c, c = true := by
refine ⟨?c, ?_⟩
cases ?c with
| true => sorry
| false => sorry
The following program seems to stackoverflow/crash both locally trying multiple versions of lean/lean lsp and the lean live on nightly.
(For example it might stall for a very long time, report "Lean server printed an error: Stack overflow detected. Aborting.", or "Server process for file:///.../test_rbtree_typecheck_timeout.lean crashed, likely due to a stack overflow or a bug. Code: -32902"
Context
[Broader context that the issue occurred in. If there was any prior discussion on the Lean Zulip, link it here as well.]
Steps to Reproduce
- Try to run the above minimized lean program.
Expected behavior: [Clear and concise description of what you expect to happen]
Make forward progress.
Actual behavior: [Clear and concise description of what actually happens]
Lean seems to crash/become non-responsive.
Versions
[Output of #version or #eval Lean.versionString]
[OS version, if not using live.lean-lang.org.]
Additional Information
I think the closest issues I found were https://github.com/leanprover/lean4/issues/2504, https://github.com/leanprover/lean4/issues/4219, https://github.com/leanprover/lean4/issues/2506 though I would not say any of these directly apply.
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the minimized Lean program from the issue against the Lean nightly release or the linked live.lean-lang.org example, confirming the stack overflow or crash when cases is applied to the metavariable. Trace the elaboration path involved and add a regression test for this program; done means it makes forward progress without crashing or becoming non-responsive.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100