Skip to content

panic in async elaboration for theorems with a docstring within where #11799

@chenson2018

Description

@chenson2018

Prerequisites

Description

The following

theorem foo : True := aux where /-- -/ aux := True.intro

triggers a panic:

PANIC at Lean.EnvExtension.modifyState Lean.Environment:1392:17: `asyncDecl` `foo.aux` is outside current context foo

Note that this does not occur with def, and can also be fixed by setting set_option Elab.async false.

Context

Reported at #CSLib > Doc-string error

Steps to Reproduce

  1. Run above example

Expected behavior: successfully add declaration

Actual behavior: panic unless async elaboration is disabled

Versions

Lean 4.27.0-rc1, Lean 4.28.0-nightly-2025-12-25
Target: x86_64-unknown-linux-gnu

Additional Information

[Additional information, configuration or data that might be necessary to reproduce the issue]

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions