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
Fix isInstanceOf[Array[?]] returning true on non-Array
Before this commit, the `MultiArrayOf(elem, ndims)` extractor used to
strip wildcards from the element type, this was surprising since it does
not match what the `ArrayOf(elem)` extractor does, and lead to a bug in
`TypeTestCasts.interceptTypeApply` which contains the following code:
case defn.MultiArrayOf(elem, ndims) if isGenericArrayElement(elem, isScala2 = false) =>
`isGenericArrayElement` returns false for `Any` but true for
`_ >: Nothing <: Any`, so the stripped wildcard means that this case was
skipped, resulting in:
x.isInstanceOf[Array[?]]
being erased to:
x.isInstanceOf[Object]
instead of:
scala.runtime.ScalaRunTime.isArray(x, 1)
Fixed by tweaking `MultiArrayOf` to keep any final wildcard around like
`ArrayOf` does.
0 commit comments