Skip to content

fix: reject attribute uses whose module is reachable only via IR#13613

Draft
Kha wants to merge 2 commits intoleanprover:masterfrom
Kha:push-zpsqupyvkwxq
Draft

fix: reject attribute uses whose module is reachable only via IR#13613
Kha wants to merge 2 commits intoleanprover:masterfrom
Kha:push-zpsqupyvkwxq

Conversation

@Kha
Copy link
Copy Markdown
Member

@Kha Kha commented May 2, 2026

This PR makes the elaborator reject @[foo] when the module that registers foo is not visibly imported into the current file but merely loaded as IR. Previously such uses silently elaborated but led to divergence of cmdline and server behavior and caused lake shake --fix to flip-flop on successive runs (#13599).

This PR makes the elaborator reject `@[foo]` when the module that registers
`foo` is reachable only via a `meta import` chain, with an error pointing at
the missing non-`meta` `import`. Previously such uses silently elaborated but
caused `shake --fix` to flip-flop on successive runs (issue leanprover#13599) because
the missing `metaExt` left an attribute's recorded import stuck as `meta`.

The check fires only for `regular_initialize`-registered attributes (i.e.
user-defined ones, not `builtin_initialize` core attributes) whose home
module has `irPhases == .comptime`.
@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 May 2, 2026
@leanprover-bot
Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-04-29 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-05-02 21:54:37)

@github-actions github-actions Bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label May 2, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label May 2, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

mathlib-lean-pr-testing Bot commented May 2, 2026

Mathlib CI status (docs):

mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request May 3, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN 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.

2 participants