leanprover / leanprover/lean4

$[$t],* ,$u accepted, but panics when $t is empty list

Open
#4,822 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P-medium
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:

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.