refactor(sorted_map): rename keys_as_iter/values_as_iter to keys/values#3591
Merged
Conversation
Collaborator
Coverage Report for CI Build 4355Coverage remained the same at 94.275%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes a previously announced breaking API change in sorted_map: SortedMap::keys() and SortedMap::values() now return iterators (Iter[K] / Iter[V]) instead of arrays, and the old *_as_iter names are preserved as deprecated aliases.
Changes:
- Renamed
keys_as_iter→keysandvalues_as_iter→values(iterator-returning APIs). - Added deprecated aliases so
keys_as_iter/values_as_itercontinue to exist. - Updated documentation and tests to use
keys()/values()and avoid deprecation warnings.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sorted_map/README.mbt.md | Updates examples to use keys() / values() iterator APIs. |
| sorted_map/map.mbt | Renames iterator APIs and adds deprecated aliases for legacy names. |
| sorted_map/map_test.mbt | Updates tests to call keys() / values() instead of deprecated names. |
| sorted_map/deprecated.mbt | Removes the old deprecated array-returning keys() / values() methods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
268
to
+296
| @@ -291,7 +292,8 @@ pub fn[K, V] SortedMap::keys_as_iter(self : SortedMap[K, V]) -> Iter[K] { | |||
|
|
|||
| ///| | |||
| /// Returns an iterator over the values in ascending key order. | |||
| pub fn[K, V] SortedMap::values_as_iter(self : SortedMap[K, V]) -> Iter[V] { | |||
| #alias(values_as_iter, deprecated) | |||
| pub fn[K, V] SortedMap::values(self : SortedMap[K, V]) -> Iter[V] { | |||
Complete the planned breaking change announced in the previous `#deprecated` notices: `SortedMap::keys`/`values` now return `Iter[K]`/ `Iter[V]` instead of `Array`, taking over the names from `keys_as_iter` and `values_as_iter`. The old `_as_iter` names remain as deprecated aliases via `#alias(..., deprecated)`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
60deca2 to
e51b1ce
Compare
4 tasks
bobzhang
added a commit
that referenced
this pull request
May 15, 2026
…forms Completes the planned breaking change announced in the existing `#deprecated` notices: `SortedMap::map`/`fold`/`filter` now accept the full `(K, X) -> Y`, `(A, K, V) -> A`, `(K, V) -> Bool` shapes, taking over the names from `map_with_key`/`foldl_with_key`/`filter_with_key`. Mirrors the same migration already done on `@immut/hashmap` (see `immut/hashmap/HAMT.mbt:171,214,237`) and the very recent rename on the mutable `@sorted_map` in #3591. - the long `_with_key` names are kept as deprecated aliases via `#alias(<name>_with_key, deprecated)` so existing callers keep compiling - removes the placeholder deprecated `map`/`fold`/`filter` stubs in `immut/sorted_map/deprecated.mbt` that were reserving the short names - updates the one internal external caller (`internal/regex_engine/automata/mark_slot_map.mbt`) and the package README / tests so the workspace builds without deprecation warnings Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.
Summary
#deprecatednotices:SortedMap::keys/valuesnow returnIter[K]/Iter[V]instead ofArray, taking over the names fromkeys_as_iter/values_as_iter._as_iternames as deprecated aliases via#alias(..., deprecated).README.mbt.md,map_test.mbt) so the package builds without deprecation warnings.Test plan
moon check— clean, no warningsmoon test— full suite (6476 tests) passes🤖 Generated with Claude Code