You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Scala 2.12, the following expression throws an UndefinedBehaviorError over a ClassCastException:
new mutable.WrappedArrayBuilder(classTag[Unit]).result()
org.scalajs.linker.runtime.UndefinedBehaviorError: java.lang.ClassCastException: [V@1 is not an instance of Ljava.lang.Object;
at $throwClassCastException (main.js:52:9)
at $throwArrayCastException (main.js:58:3)
at $asArrayOf_O (main.js:811:5)
at $c_scm_WrappedArray$.make__O__scm_WrappedArray (WrappedArray.scala:105:10)
at $p_scm_WrappedArrayBuilder__mkArray__I__scm_WrappedArray (ClassTag.scala:54:33)
at $c_scm_WrappedArrayBuilder.result__scm_WrappedArray (WrappedArrayBuilder.scala:110:17)
at $c_Lhelloworld_HelloWorld$.main__AT__V (HelloWorld.scala:17:62)
at $s_Lhelloworld_HelloWorld__main__AT__V (HelloWorld.scala:14:8)
As the error message shows, we managed to create a [V, i.e., a void[]. This is not even supposed to be possible. It should be a scala.runtime.BoxedUnit[], which in Scala.js is actually a java.lang.Void[].
This regression appeared upstream in scala/scala#9091. That PR changed WrappedArrayBuilder to use ClassTag.emptyWrappedArray, which was defined as
We copied that implementation in our overrides for ClassTag in 636be50
Unfortunately, it turned out that it was buggy. It was later fixed upstream in scala/scala@5e6676d
but we didn't notice that, so we didn't port the fix.
Using Scala 2.12, the following expression throws an
UndefinedBehaviorError
over aClassCastException
:As the error message shows, we managed to create a
[V
, i.e., avoid[]
. This is not even supposed to be possible. It should be ascala.runtime.BoxedUnit[]
, which in Scala.js is actually ajava.lang.Void[]
.This regression appeared upstream in scala/scala#9091. That PR changed
WrappedArrayBuilder
to useClassTag.emptyWrappedArray
, which was defined asWe copied that implementation in our overrides for
ClassTag
in636be50
Unfortunately, it turned out that it was buggy. It was later fixed upstream in
scala/scala@5e6676d
but we didn't notice that, so we didn't port the fix.
This blew up when scala-collection-compat tried to upgrade to Scala.js 1.6.0 in scala/scala-collection-compat#462
The text was updated successfully, but these errors were encountered: