-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Synchronize standard library sources with Scala 2.13.18 #24788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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 <[email protected]> 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.
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
There was a problem hiding this comment.
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.
|
We're supposed to have a long-lived branch that constantly |
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