Skip to content

Conversation

@kmill
Copy link
Collaborator

@kmill kmill commented Jun 3, 2025

This PR fixes (1) an issue where private names are not unresolved when they are pretty printed, (2) an issue where in pp.universes mode names were allowed to shadow local names, (3) an issue where in match patterns constants shadowing locals wouldn't use _root_, and (4) an issue where tactics might have an incorrect "try this" when pp.fullNames is set. Adds more delaboration tests for name unresolution.

It also cleans up the delabConst delaborator so that it uses unresolveNameGlobalAvoidingLocals, rather than doing any local context analysis itself. The inPattern logic has been removed; it was a heuristic added back in #575, but it now leads to incorrect results (and in match patterns, local names shadow constants in name resolution).

This PR fixes an issue where private names are not unresolved when they are pretty printed, and an issue where in `pp.universes` mode names were allowed to shadow local names. Adds more delaboration tests for name unresolution.

It also cleans up the `delabConst` delaborator so that it uses `unresolveNameGlobalAvoidingLocals`, rather than doing any local context analysis itself. The `inPattern` logic has been removed; it appears to have been a heuristic added back in leanprover#575, but it's not clear what the current purpose is, and there are no tests that show that it is still needed.
@kmill kmill added the changelog-pp Pretty printing label Jun 3, 2025
@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 Jun 3, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jun 3, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jun 3, 2025
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Jun 3, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Jun 3, 2025

Mathlib CI status (docs):

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jun 3, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jun 3, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jun 3, 2025
@kmill kmill enabled auto-merge June 3, 2025 23:37
@kmill kmill added this pull request to the merge queue Jun 3, 2025
Merged via the queue into leanprover:master with commit 5e95259 Jun 4, 2025
19 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 changelog-pp Pretty printing 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