Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: automatic instance names about types with hygienic names should be hygienic #5530

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Sep 30, 2024

Macros sometimes create auxiliary types and instances about them, and they rely on the instance name generate to create unique names in that case.

This modifies the automatic name generator to add a fresh macro scope to the generated name if any of the constants in the type of the instance themselves have macro scopes.

Closes #2044

…be hygienic

Macros sometimes create auxiliary types and instances about them, and they rely on the instance name generate to create unique names in that case.

This modifies the automatic name generator to add a fresh macro scope to the generated name if any of the constants in the type of the instance themselves have macro scopes.

Closes leanprover#2044
@kmill kmill requested a review from mhuisi as a code owner September 30, 2024 02:17
@kmill
Copy link
Collaborator Author

kmill commented Sep 30, 2024

@Kha What do you think about having the auto-generated instance names use a fresh macro scope if any of the constants in the type of the instance themselves have macro scopes? There's a chance this is too conservative, in case somehow there are instances with macro scopes for example, but I was afraid of not being conservative enough.

It's still using the name generator for debuggability, if you need to poke around the macro expansions.

@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 Sep 30, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Sep 30, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Sep 30, 2024
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Sep 30, 2024
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

src/Lean/Elab/DeclNameGen.lean Outdated Show resolved Hide resolved
@kmill kmill added this pull request to the merge queue Sep 30, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Sep 30, 2024
Merged via the queue into leanprover:master with commit d3f7ed4 Sep 30, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR 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.

Auto-generated instance names do not inherit macro scopes
3 participants