Skip to content

Conversation

@WojciechMazur
Copy link
Contributor

@WojciechMazur WojciechMazur commented Dec 21, 2025

Synchronize stdlib with changes made between Scala 2.13.17 (last sync made in #24063) and 2.13.18 (latest Scala 2.13 release)

Also adds a script to synchronize changes in the future

Fixes #24204

lrytz and others added 5 commits December 21, 2025 14:21
When using an array as sequence argument in Scala 3, the
compiler emits a conversion to a `Seq` using `ScalaRunTime.wrapXArray`.
The change in PR 11021 affects the semantics of such code.

Upstream: scala/scala@1af76c7
Some functions appear to be using an outdated name for the ordering function parameter (formerly cmp, now ord) in the documentation. Those are changed to the current name (ord).

Signed-off-by: Evgeny Vereshchagin <[email protected]>

Upstream: scala/scala@80589cc
@WojciechMazur WojciechMazur requested a review from a team as a code owner December 21, 2025 13:39
Comment on lines 300 to 310
def genericWrapArray[T](xs: Array[T]): ArraySeq[T] = if (xs ne null) ArraySeq.unsafeWrapArray(xs) else null.asInstanceOf[ArraySeq[T]]
def wrapRefArray[T <: AnyRef | Null](xs: Array[T]): ArraySeq[T] = if (xs ne null) new ArraySeq.ofRef[T](xs) else null.asInstanceOf[ArraySeq[T]]
def wrapIntArray(xs: Array[Int]): ArraySeq[Int] = if (xs ne null) new ArraySeq.ofInt(xs) else null.asInstanceOf[ArraySeq[Int]]
def wrapDoubleArray(xs: Array[Double]): ArraySeq[Double] = if (xs ne null) new ArraySeq.ofDouble(xs) else null.asInstanceOf[ArraySeq[Double]]
def wrapLongArray(xs: Array[Long]): ArraySeq[Long] = if (xs ne null) new ArraySeq.ofLong(xs) else null.asInstanceOf[ArraySeq[Long]]
def wrapFloatArray(xs: Array[Float]): ArraySeq[Float] = if (xs ne null) new ArraySeq.ofFloat(xs) else null.asInstanceOf[ArraySeq[Float]]
def wrapCharArray(xs: Array[Char]): ArraySeq[Char] = if (xs ne null) new ArraySeq.ofChar(xs) else null.asInstanceOf[ArraySeq[Char]]
def wrapByteArray(xs: Array[Byte]): ArraySeq[Byte] = if (xs ne null) new ArraySeq.ofByte(xs) else null.asInstanceOf[ArraySeq[Byte]]
def wrapShortArray(xs: Array[Short]): ArraySeq[Short] = if (xs ne null) new ArraySeq.ofShort(xs) else null.asInstanceOf[ArraySeq[Short]]
def wrapBooleanArray(xs: Array[Boolean]): ArraySeq[Boolean] = if (xs ne null) new ArraySeq.ofBoolean(xs) else null.asInstanceOf[ArraySeq[Boolean]]
def wrapUnitArray(xs: Array[Unit]): ArraySeq[Unit] = if (xs ne null) new ArraySeq.ofUnit(xs) else null.asInstanceOf[ArraySeq[Unit]]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@noti0na1 is it ok? Should we adjust the signature as well? I'm not sure what's the best approach here, should we kept it as it is for backward compatibility, make output nullable, or both input and output

Copy link
Member

Choose a reason for hiding this comment

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

The signatures look good to me. We can use ScalaRunTime.mapNull for rhs to deal with situations like this.

@WojciechMazur WojciechMazur added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Dec 21, 2025
@WojciechMazur WojciechMazur added this to the 3.8.0 milestone Dec 21, 2025
@sjrd
Copy link
Member

sjrd commented Dec 21, 2025

We're supposed to have a long-lived branch that constantly filter-repos Scala 2, so that we can have the exact same commits merged into main (rather than cherry-picked). @hamzaremmal Where's that branch?

@WojciechMazur WojciechMazur requested a review from lrytz December 22, 2025 13:38
@WojciechMazur WojciechMazur merged commit 3c90d5e into scala:main Dec 22, 2025
93 of 94 checks passed
@WojciechMazur WojciechMazur deleted the stdlib-sync/2.13.18 branch December 22, 2025 17:00
@hamzaremmal
Copy link
Member

We're supposed to have a long-lived branch that constantly filter-repos Scala 2, so that we can have the exact same commits merged into main (rather than cherry-picked). @hamzaremmal Where's that branch?

It might have been deleted after merging the PR. I'll push it once again and make sure branch protection are set so we cannot force push into it and delete it.

@WojciechMazur WojciechMazur added backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" and removed backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. labels Dec 30, 2025
WojciechMazur added a commit that referenced this pull request Dec 31, 2025
… 3.8.0 (#24862)

Backports #24788 to the 3.8.0-RC5.

PR submitted by the release tooling.
[skip ci]
@WojciechMazur WojciechMazur added backport:done This PR was successfully backported. and removed backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" labels Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:done This PR was successfully backported.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression for unpacking var-arg splices when using Scala 2.13.17

8 participants