[Scala 3] consolidate type+val aliases to export#872
Open
halotukozak wants to merge 5 commits into
Open
Conversation
Replace `type X = Y` + `final val X = Y` pairs with single Scala 3 `export` clauses. Behavior identical for downstream (same imports resolve, same types/terms available); declaration count cut in half. Mirrors halotukozak fork `origin/master` shape for CommonAliases.
Replace `type X[+A] = ... ; final val X = ...` pairs with single `export` clauses. Mirrors halotukozak fork shape.
Replace `type X[+A] = pkg.Y[A]` + `final def X: pkg.Y.type = pkg.Y`
pairs with single Scala 3 `export pkg.Y as X` clauses. Each rename
collapses two declarations to one; variance is preserved by the
re-exported source symbol.
`MColBuilder` kept as plain `type` — its RHS shape
(`scm.Builder[Elem, Col[Elem]]`) is a higher-kinded substitution,
not a symbol rename, so `export` doesn't apply.
`MBuilder` converts cleanly (pure rename of `scm.Builder`).
Drift from halotukozak fork: fork `origin/master` keeps the
`type + final def` pair shape for CollectionAliases. We diverge
per user directive 2026-06-01 to consolidate via `export`.
Also modernized one Scala 2-style import to Scala 3 form
(`scala.{collection => sc}` → `scala.collection as sc`).
Trivial polish: now that `MBuilder` is exported, `MColBuilder`'s RHS references the project-local alias instead of `scm.Builder` directly. Pure cosmetic; same resolved symbol.
Document the `CommonAliases` / `MiscAliases` / `CollectionAliases` shape change in MIGRATION.md §3 source-compat. Source-level callers unaffected; JVM bytecode no longer emits redundant forwarders.
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.
Slice: 3.6 of Phase 3 (Scala 3 syntax modernization)
Merge order: Independent — can land any time (no overlap with 3.1/3.2/3.3/3.4/3.5)
Depends on: none
Base branch: upstream/scala-3 (not stacked)
Consolidate
type X = Y; final def X: Y.type = Yandtype X = Y; final val X: Y.type = Ypatterns into Scala 3export Y(orexport Y as Xfor rename) clauses. Reduces redundancy: a single declaration re-exports both the type AND the term.Touches:
core/.../CommonAliases.scala—Try/Success/Failure/Future/Promise/ExecutionContext/NonFatal/ClassTag/classTag/Annotation/StaticAnnotationcore/.../misc/MiscAliases.scala—Opt/OptArg/NOpt/OptRefcore/.../collection/CollectionAliases.scala— ~30 rename pairs (BIterable/IIterable/MIterable/…/MArrayBuffer);MColBuilderretained as plaintype(RHS is HK substitution, not a pure rename)MIGRATION.md§3 updated with the source-compat note.sbt compile + Test/compile + scalafmtCheckAllexit 0. No new warnings, no@nowarn/-Wconf.Drift note
halotukozak fork (
origin/master) already usesexportforCommonAliasesandMiscAliases; we mirror it. ForCollectionAliasesthe fork still keeps thetype + final defpair shape — we diverge per user directive 2026-06-01 to consolidate viaexport.