feat: add markMeta parameter to addAndCompile#13311
Merged
Kha merged 2 commits intoleanprover:masterfrom Apr 8, 2026
Merged
Conversation
Downstream projects that dynamically create definitions derived from `meta` declarations need to split `addAndCompile` into `addDecl` + `markMeta` + `compileDecl` to propagate the meta marking before compilation. Adding an optional `markMeta` flag avoids this boilerplate. Also updates `ParserCompiler` to use the new parameter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The import is only used in the body of `addAndCompile`, not in its public signature. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
We have 4 repeats of this pattern in Verso moving to v4.30.0-rc1. |
kim-em
added a commit
to kim-em/lean4
that referenced
this pull request
Apr 8, 2026
This PR fixes `processDefDeriving` to propagate the `meta` attribute to instances derived via delta deriving. Previously, `deriving BEq` inside a `public meta section` for a definition would produce a non-meta instance, causing the LCNF visibility checker to reject meta definitions that use `==`. The fix has two parts: 1. Compute `isMeta` from the meta section scope and the type's meta status, and use it for both `wrapInstance` aux declarations and `addAndCompile`. 2. Use `addAndCompile (markMeta := isMeta)` (from leanprover#13311) so the meta tag is set before compilation, matching how the normal command elaboration pipeline handles meta definitions. Closes leanprover#13313 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 task
kim-em
added a commit
to kim-em/lean4
that referenced
this pull request
Apr 8, 2026
This PR fixes `processDefDeriving` to propagate the `meta` attribute to instances derived via delta deriving. Previously, `deriving BEq` inside a `public meta section` for a definition would produce a non-meta instance, causing the LCNF visibility checker to reject meta definitions that use `==`. The fix has two parts: 1. Compute `isMeta` from the meta section scope and the type's meta status, and use it for both `wrapInstance` aux declarations and `addAndCompile`. 2. Use `addAndCompile (markMeta := isMeta)` (from leanprover#13311) so the meta tag is set before compilation, matching how the normal command elaboration pipeline handles meta definitions. Closes leanprover#13313 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
kim-em
added a commit
to kim-em/lean4
that referenced
this pull request
Apr 8, 2026
This PR fixes `processDefDeriving` to propagate the `meta` attribute to instances derived via delta deriving. Previously, `deriving BEq` inside a `public meta section` for a definition would produce a non-meta instance, causing the LCNF visibility checker to reject meta definitions that use `==`. The fix has two parts: 1. Compute `isMeta` from the meta section scope and the type's meta status, and use it for both `wrapInstance` aux declarations and `addAndCompile`. 2. Use `addAndCompile (markMeta := isMeta)` (from leanprover#13311) so the meta tag is set before compilation, matching how the normal command elaboration pipeline handles meta definitions. Closes leanprover#13313 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
kim-em
added a commit
to kim-em/lean4
that referenced
this pull request
Apr 8, 2026
This PR fixes `processDefDeriving` to propagate the `meta` attribute to instances derived via delta deriving. Previously, `deriving BEq` inside a `public meta section` for a definition would produce a non-meta instance, causing the LCNF visibility checker to reject meta definitions that use `==`. The fix has two parts: 1. Compute `isMeta` from the meta section scope and the type's meta status, and use it for both `wrapInstance` aux declarations and `addAndCompile`. 2. Use `addAndCompile (markMeta := isMeta)` (from leanprover#13311) so the meta tag is set before compilation, matching how the normal command elaboration pipeline handles meta definitions. Closes leanprover#13313 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
github-actions bot
pushed a commit
that referenced
this pull request
Apr 8, 2026
This PR adds an optional `markMeta : Bool := false` parameter to `addAndCompile`, so that callers can propagate the `meta` marking without manually splitting into `addDecl` + `markMeta` + `compileDecl`. Also updates `ParserCompiler` to use the new parameter. 🤖 Prepared with Claude Code --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 334d9bd)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an optional
markMeta : Bool := falseparameter toaddAndCompile, so that callers can propagate themetamarking without manually splitting intoaddDecl+markMeta+compileDecl.Also updates
ParserCompilerto use the new parameter.🤖 Prepared with Claude Code