feat(sorted_map): make trait promotions explicit via extend#3858
Merged
Conversation
Collaborator
Coverage Report for CI Build 5306Coverage remained the same at 91.293%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
Migrates the sorted_map package away from implicit trait-method promotion by making promotions explicit via an extends.mbt shim, aligning with the ongoing per-package migration series (as previously done for deque).
Changes:
- Enable
+implicit_impl_as_methodwarnings forsorted_mapto surface and prevent implicit promotion usage. - Add an
extends.mbtshim that explicitly promotesDefault::{default}while deprecating (and hiding from generated interface) prior promoted trait methods likeToJson::to_json,@json.FromJson::from_json,Eq,Show, etc. - Update
sorted_maptests to use@json.to_json(...)/@json.from_json(...)instead of the deprecated promoted.to_json()method.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sorted_map/pkg.generated.mbti | Reflects the newly promoted SortedMap::default() in the generated public interface. |
| sorted_map/moon.pkg | Enables +implicit_impl_as_method warnings for this package to enforce the migration. |
| sorted_map/map_test.mbt | Updates JSON roundtrip tests to use @json.to_json / @json.from_json instead of deprecated promoted methods. |
| sorted_map/extends.mbt | Introduces explicit trait promotions and hidden deprecations to replace implicit trait-method promotion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bobzhang
enabled auto-merge (rebase)
July 22, 2026 08:19
Enable `implicit_impl_as_method` (E0079) for the `sorted_map` package (in its moon.pkg) and make its trait-impl promotions explicit via `extend`, in a dedicated sorted_map/extends.mbt shim. - Promote (plain `pub extend`): Default. - Deprecate (`#deprecated(..., skip_current_package=true)` + `#doc(hidden)`): @quickcheck.Arbitrary, @debug.Debug, Eq, @json.FromJson, the whole Show trait (to_string + output), and ToJson. Each message names the concrete replacement. SortedMap is a collection, so its Show is deprecated in favour of @debug.Debug. ToJson is deprecated in favour of the free @json.to_json (#3850). Also migrates sorted_map's own blackbox test off the now-deprecated `.to_json()` (-> `@json.to_json(...)`). pkg.generated.mbti gains only SortedMap::default. Part of the per-package series (see #3849 for deque). Scoped to sorted_map/. Verified: `moon check --deny-warn --target all` clean; `moon test --target all` green. Reviewed by Codex CLI: seven extends cover exactly the flagged methods, split + replacement messages match policy, all three blackbox .to_json() callers migrated, scoped to sorted_map/ with .mbti adding only SortedMap::default. Signed-off-by: Codex CLI <codex@openai.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bobzhang
force-pushed
the
hongbo/extend-sorted_map
branch
from
July 22, 2026 08:38
340aa04 to
d23314f
Compare
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
Part of the per-package series migrating
moonbitlang/coreoff implicit trait-method promotion (see #3849 fordeque). This one coverssorted_maponly.pub extend#deprecated(…, skip_current_package=true)+#doc(hidden)Default@quickcheck.Arbitrary,@debug.Debug,Eq,@json.FromJson, the wholeShowtrait,ToJsonShowis deprecated for collections —SortedMap'sShowimpl is already#deprecatedonmain(→@debug.Debug).ToJson/FromJsonpoint to the@json.to_json/@json.from_jsonfree functions; each deprecation message names the concrete replacement.#doc(hidden)on all deprecations, sopkg.generated.mbtigains onlySortedMap::default.Migrates sorted_map's own blackbox test off the now-deprecated
.to_json()(→@json.to_json(...)). Scoped tosorted_map/.Verification
moon check --deny-warn --target all— clean.moon test -p moonbitlang/core/sorted_map --target all— green (87×4).Signed-off-by: Codex CLI <codex@openai.com>