refactor: use String.Slice in String.take and variants#11180
Merged
TwoFX merged 7 commits intoleanprover:masterfrom Nov 18, 2025
Merged
refactor: use String.Slice in String.take and variants#11180TwoFX merged 7 commits intoleanprover:masterfrom
String.Slice in String.take and variants#11180TwoFX merged 7 commits intoleanprover:masterfrom
Conversation
29bf6bb to
46a0a74
Compare
Member
Author
|
!radar |
|
Benchmark results for bda0362 against 5ce1f67 are in! @TwoFX Major changes (12)
Minor changes (10)
|
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
bda0362 to
fd4047c
Compare
ghost
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Nov 18, 2025
ghost
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Nov 18, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 20, 2025
This PR adds a few deprecations for functions that never existed but that are still helpful for people migrating their code post-#11180.
kim-em
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Nov 23, 2025
* Update lean-toolchain for testing leanprover/lean4#11232 * A few fixes * Update lean-toolchain for leanprover/lean4#11232 * Update lean-toolchain for testing leanprover/lean4#11180 * lake update * Fix * Fixed Cli * Fix cache and tests * chore: bump to nightly-2025-11-19 * lake update * deprecations * fix merge * lake update proofwidgets * lake update aesop * some `grind +revert` * chore: bump to nightly-2025-11-20 * lake update batteries * grind +revert * chore: adaptations for nightly-2025-11-20 * add grind regression test * chore: bump to nightly-2025-11-21 * chore: adaptations for nightly-2025-11-21 * lake update --------- Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Markus Himmel <markus@lean-fro.org> Co-authored-by: Kim Morrison <kim@tqft.net> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: mathlib4-bot <github-mathlib4-bot@leanprover.zulipchat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR redefines
String.takeand variants to operate onString.Slice. While previously functions returning a substring of the input sometimes returnedStringand sometimes returnedSubstring.Raw, they now uniformly returnString.Slice.This is a BREAKING change, because many functions now have a different return type. So for example, if
sis a string andfis a function accepting a string,f (s.drop 1)will no longer compile becauses.drop 1is aString.Slice. To fix this, insert a call tocopyto restore the old behavior:f (s.drop 1).copy.Of course, in many cases, there will be more efficient options. For example, don't write
f <| s.drop 1 |>.copy |>.dropEnd 1 |>.copy, writef <| s.drop 1 |>.dropEnd 1 |>.copyinstead. Also, instead of(s.drop 1).copy = "Hello", writes.drop 1 == "Hello".toSliceinstead.