$[$t],* ,$u accepted, but panics when $t is empty list
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Prerequisites
Please put an X between the brackets as you perform the following steps:
- 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
In macro_rules, the (`tactic|...) quotation allows to concatenate a possibly empty list with a single element putting a separator in the middle. When the rule is triggered on an empty list, the result is a singleton list that starts with the separator, leading to some panic in tactic code. The following is a minimal example:
syntax "foo " ident,* : tactic
macro_rules
| `(tactic| foo $[$terms],*) =>
`(tactic| solve_by_elim only [$[$terms:ident],* ,0])
def foo: True := by
foo
Steps to Reproduce
Run the code above. The last line triggers the panic
Versions
4.9.0-rc3
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 with the minimal macro_rules example in the issue and trace the tactic quotation handling for an empty $terms list. Done means the example no longer panics and produces the intended singleton list with the separator in the expected position.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100