Skip to content

Conversation

@kim-em
Copy link
Collaborator

@kim-em kim-em commented Jan 3, 2026

This PR adds a guard to TagDeclarationExtension.tag to check if the declaration name is anonymous and return early if so. This prevents a panic that could occur when modifiers like meta or noncomputable are used in combination with syntax errors.

Reproducer:

public meta section
def private

Previously this would panic with:

PANIC at Lean.EnvExtension.modifyState: called on `async` extension,
must set `asyncDecl` in that case

This follows the same pattern as the fix in #10131 for addDocString and the existing guard in markNotMeta.

See https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/panic.20on.20doc-string/near/566110399

🤖 Prepared with Claude Code

This PR adds a guard to `TagDeclarationExtension.tag` to check if the
declaration name is anonymous and return early if so. This prevents a
panic that could occur when modifiers like `meta` or `noncomputable` are
used in combination with syntax errors.

Reproducer:
```lean
public meta section
def private
```

Previously this would panic with:
```
PANIC at Lean.EnvExtension.modifyState: called on `async` extension,
must set `asyncDecl` in that case
```

This follows the same pattern as the fix in #10131 for `addDocString` and
the existing guard in `markNotMeta`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@kim-em kim-em added the changelog-language Language features and metaprograms label Jan 3, 2026
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jan 3, 2026
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase fab1897f28ed5e994a5d39a43e57b47e0b89c48c --onto 4e8b5cfc4696efb13c2fb3dc8ae6033197ae2b1f. You can force Mathlib CI using the force-mathlib-ci label. (2026-01-03 11:30:02)

@leanprover-bot
Copy link
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase fab1897f28ed5e994a5d39a43e57b47e0b89c48c --onto 4e8b5cfc4696efb13c2fb3dc8ae6033197ae2b1f. You can force reference manual CI using the force-manual-ci label. (2026-01-03 11:30:03)

@kim-em kim-em requested a review from Kha January 4, 2026 08:27
@kim-em kim-em added this pull request to the merge queue Jan 5, 2026
Merged via the queue into master with commit 35d8925 Jan 5, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-language Language features and metaprograms toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants