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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it.

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

6 participants