Skip to content

declare_syntax_cat in private section causes "unknown constant" on import #11823

@datokrat

Description

@datokrat

Prerequisites

Description

When using declare_syntax_cat in a private section of a module, importing the module fails with an "unknown constant" error.

Steps to Reproduce

  1. Check out the Lake project in this branch: https://github.com/datokrat/lean-bug-reproductions/tree/bugs8
  2. Open Reproductions/Basic.lean and observe that Lean complains fails to import Reproductions.Dependency.lean.

Reproductions/Basic.lean:

module

public import Reproductions.Dependency

Reproductions/Dependency.lean:

module

declare_syntax_cat ebnf

Expected behavior:

No errors, module is imported successfully.

Actual behavior:

Error: `Unknown constant `_private.Reproductions.Dependency.0.ebnf.quot`

There is a workaround: The error disappears if declare_syntax_cat is wrapped in a public section.

Versions

Lean 4.28.0-nightly-2025-12-28
Target: arm64-apple-darwin24.6.0 macOS

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