Synchronize standard library sources with Scala 2.13.18#24788
Synchronize standard library sources with Scala 2.13.18#24788WojciechMazur merged 8 commits intoscala:mainfrom
Conversation
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 <ev@ev-ev.me> Upstream: scala/scala@80589cc
| 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]] |
There was a problem hiding this comment.
@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
There was a problem hiding this comment.
The signatures look good to me. We can use ScalaRunTime.mapNull for rhs to deal with situations like this.
|
We're supposed to have a long-lived branch that constantly |
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. |
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