Skip to content

feat: add newDecls fields to Core.State and Command.State#13731

Draft
wkrozowski wants to merge 3 commits into
leanprover:masterfrom
wkrozowski:wojciech/linterNamesExperiment
Draft

feat: add newDecls fields to Core.State and Command.State#13731
wkrozowski wants to merge 3 commits into
leanprover:masterfrom
wkrozowski:wojciech/linterNamesExperiment

Conversation

@wkrozowski
Copy link
Copy Markdown
Contributor

This PR adds newDecls fields to Core.State and Command.State, that is reseted every-time we elab a top-level command and is used to record newly added declarations to the environment. The primary goal of this change is to enable Lean.Linters to easily look-up newly added declarations and lint them.

chore: thread `newDecls`

chore: add getters

chore: do not reset on `wrapAsyncAsSnapshot`
@wkrozowski wkrozowski added the changelog-language Language features and metaprograms label May 14, 2026
@wkrozowski
Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented May 14, 2026

Benchmark results for efa5c8f against 793cd14 are in. (These commits have already been benchmarked in a previous command.) No significant results found. @wkrozowski

  • 🟥 build//instructions: +3.1G (+0.03%)

Small changes (1✅, 4🟥)

  • 🟥 build/module/Lean.AddDecl//instructions: +196.6M (+3.24%) (reduced significance based on *//lines)
  • 🟥 build/module/Lean.CoreM//instructions: +74.4M (+0.96%)
  • 🟥 build/module/Lean.Elab.Command//instructions: +108.3M (+0.75%)
  • 🟥 build/module/Lean.Elab.MutualDef//instructions: +104.3M (+0.37%)
  • elab/grind_ring_5//instructions: -17.2M (-0.20%)

@wkrozowski
Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented May 14, 2026

Benchmark results for efa5c8f against 793cd14 are in. (These commits have already been benchmarked in a previous command.) No significant results found. @wkrozowski

  • 🟥 build//instructions: +3.1G (+0.03%)

Small changes (1✅, 4🟥)

  • 🟥 build/module/Lean.AddDecl//instructions: +196.6M (+3.24%) (reduced significance based on *//lines)
  • 🟥 build/module/Lean.CoreM//instructions: +74.4M (+0.96%)
  • 🟥 build/module/Lean.Elab.Command//instructions: +108.3M (+0.75%)
  • 🟥 build/module/Lean.Elab.MutualDef//instructions: +104.3M (+0.37%)
  • elab/grind_ring_5//instructions: -17.2M (-0.20%)

@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 14, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 793cd14b3816dfec686daa8515d6fc750c6f7326 --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force Mathlib CI using the force-mathlib-ci label. (2026-05-14 13:25:41)

@leanprover-bot
Copy link
Copy Markdown
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 793cd14b3816dfec686daa8515d6fc750c6f7326 --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force reference manual CI using the force-manual-ci label. (2026-05-14 13:25:43)

Copy link
Copy Markdown
Collaborator

@nomeata nomeata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work as expected in the presence of asynchronous elaboration? It seems this currently ignores declarations added asynchronously, but should it may block on that?

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.

4 participants