Skip to content

feat: warn on inexact deprecations - #14600

Merged
TwoFX merged 8 commits into
leanprover:masterfrom
TwoFX:julia/inexact-2
Aug 10, 2026
Merged

feat: warn on inexact deprecations#14600
TwoFX merged 8 commits into
leanprover:masterfrom
TwoFX:julia/inexact-2

Conversation

@TwoFX

@TwoFX TwoFX commented Jul 30, 2026

Copy link
Copy Markdown
Member

This PR adds a warning when deprecating a declaration in favor of another declaration that is not reducibly defeq.

Here is the warning in full:

deprecated.lean:20:2-20:43: warning: The updated constant has a different type:
  Nat
instead of
  Nat → Nat

This suggests that addressing the deprecation might be more involved than simply replacing the old name with the new name. This is often excepected, but sometimes it indicates that the deprecation is in favor of the wrong declaration, or that there is a mistake in one of the statements.

If the type difference is intentional, use `+typeChanged` to silence this warning.

Hint: Add `+typeChanged`:
  [apply] +typeChanged

The majority of the diff is removing deprecated declarations which would have triggered this warning but are overdue for removal anyway.

@TwoFX TwoFX added changelog-language Language features and metaprograms downstream Request a downstream-lean4 adaptation PR. labels Jul 30, 2026
@downstream-lean4

downstream-lean4 Bot commented Jul 30, 2026

Copy link
Copy Markdown

The adaptation PR for this PR is leanprover/downstream-lean4#21.

@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 Jul 30, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Jul 30, 2026

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2026-07-29 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Mathlib CI should run now. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-30 06:17:59)
  • 💥 Mathlib branch lean-pr-testing-14600 build failed against this PR. (2026-08-10 09:38:35) View Log

@leanprover-bot leanprover-bot added the breaks-manual This is not necessarily a blocker for merging, but there needs to be a plan. label Jul 30, 2026
@leanprover-bot

leanprover-bot commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Jul 30, 2026
@TwoFX
TwoFX marked this pull request as ready for review July 30, 2026 14:21
@TwoFX

TwoFX commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

@wkrozowski If you have a minute, I'd appreciate your review on the meta code.

Comment thread src/Lean/Linter/Deprecated.lean
Comment thread src/Lean/Linter/Deprecated.lean
@github-actions github-actions Bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Aug 10, 2026
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Aug 10, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Aug 10, 2026
@TwoFX
TwoFX added this pull request to the merge queue Aug 10, 2026
Merged via the queue into leanprover:master with commit b1814ca Aug 10, 2026
28 checks passed
kim-em pushed a commit to leanprover-community/batteries that referenced this pull request Aug 13, 2026
leanprover/lean4#14600 warns when a deprecation's replacement has a
different type. All eleven sites here are intentional: in each case the
deprecated declaration's own proof is the replacement, either instantiated
at a more specific argument or rearranged, so the marker is the right
response rather than a change of target.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
kim-em added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Aug 14, 2026
Picks up the `+typeChanged` markers for the eleven inexact deprecations
leanprover/lean4#14600 flags in Batteries, which `main` does not carry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaks-manual This is not necessarily a blocker for merging, but there needs to be a plan. breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan changelog-language Language features and metaprograms downstream Request a downstream-lean4 adaptation PR. mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN 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.

3 participants