Skip to content

Conversation

@datokrat
Copy link
Contributor

@datokrat datokrat commented Dec 4, 2025

This PR implements a linter that warns when a deprecated coercion is applied. It also warns when the Option coercion or the Subarray-to-Array coercion is used in Init or Std. The linter is currently limited to Coe instances; CoeFun instances etc. are not considered.

The linter works by collecting the Coe instance declaration names that are being expanded in expandCoe? and storing them in the info tree. The linter itself then analyzes the info tree and checks for banned or deprecated coercions.

@datokrat datokrat added the changelog-language Language features and metaprograms label Dec 4, 2025
fix test and simp 'copy' to 'toArray'

write linter

add backticks

make the linter more defensive to avoid panics

make sure stage0 is updated after merging

revert the changes in src/Lean

why doesn't this work?

Revert "revert the changes in src/Lean"

This reverts commit 75c7082.

revert the changes in src/Lean
@datokrat datokrat force-pushed the paul/slices/subarraycopy branch from fd79930 to 1e5d986 Compare December 4, 2025 14:08
@datokrat
Copy link
Contributor Author

datokrat commented Dec 4, 2025

!radar

@leanprover-radar
Copy link

leanprover-radar commented Dec 4, 2025

Benchmark results for 9cb732c against 0173444 are in! @datokrat

Minor changes (5)
  • 🟥 Init.Prelude async//instructions: +74.3M (+0.6%)
  • 🟥 Std.Data.Internal.List.Associative//instructions: +472.5M (+0.5%)
  • 🟥 build//instructions: +29.6G (+0.2%)
  • lake config import//instructions: -10.8M (-0.7%)
  • 🟥 simp_congr//instructions: +135.6M (+0.7%)

@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 Dec 4, 2025
@leanprover-bot
Copy link
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2025-12-03 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2025-12-04 16:24:18)

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Dec 4, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Dec 4, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Dec 4, 2025

Mathlib CI status (docs):

@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Dec 4, 2025
@datokrat datokrat marked this pull request as ready for review December 5, 2025 06:47
@datokrat datokrat requested a review from mhuisi December 5, 2025 06:47
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Dec 5, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Dec 5, 2025
return (← getOptions).get linter.deprecatedCoercions.name true

/-- A list of coercion names that must not be used in core. -/
def coercionsBannedInCore : List Name := [``optionCoe, ``instCoeSubarrayArray]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array? Not that it matters much :-)

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 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.

6 participants