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: show error messages on name conflicts in mutual blocks #6939

Merged
merged 5 commits into from
Feb 5, 2025

Conversation

jrr6
Copy link
Contributor

@jrr6 jrr6 commented Feb 4, 2025

This PR adds error messages for inductive declarations with conflicting constructor names and mutual declarations with conflicting names.

Closes #6694.

@jrr6 jrr6 added the changelog-language Language features, tactics, and metaprograms label Feb 4, 2025
@jrr6
Copy link
Contributor Author

jrr6 commented Feb 4, 2025

Of note, because conflicting definitions are elaborated simultaneously and without inherently privileging one or the other, I've opted to display errors at both conflicting locations to aid visual localization. This does come with the trade-off of differing from our conflicting-name errors outside mutual blocks, which appear only at the last occurrence in the file. My sense was that mutual blocks already behave differently in nontrivial ways from other declarations, so this deviation in presentation is, as it were, consistent with those other inconsistencies. Alternatively, we could simply surface errors at the last declaration in the mutual block (and likewise for the last problematic inductive/constructor) as we do elsewhere, though at the cost of making the user hunt for the conflicting declaration (jump-to-definition won't work in these instances because the mutual/inductive elaborates monolithically).

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

leanprover-community-bot commented Feb 4, 2025

Mathlib CI status (docs):

@jrr6 jrr6 marked this pull request as ready for review February 4, 2025 16:12
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Feb 5, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Feb 5, 2025
@jrr6 jrr6 force-pushed the mutual-duplicates branch from 28d4fe6 to 9f574f5 Compare February 5, 2025 01:45
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Feb 5, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Feb 5, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Feb 5, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Feb 5, 2025
@jrr6 jrr6 added this pull request to the merge queue Feb 5, 2025
Merged via the queue into leanprover:master with commit 1f956ad Feb 5, 2025
15 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-language Language features, tactics, 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.

duplicate definition names not detected in mutual block
3 participants