Skip to content

Commit 6912ff8

Browse files
committed
Fix for seq/array varargs crasher.
Closes SI-4024.
1 parent 53a1a57 commit 6912ff8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/compiler/scala/tools/nsc/transform/UnCurry.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ abstract class UnCurry extends InfoTransform
374374
assert(toArraySym != NoSymbol)
375375
def getManifest(tp: Type): Tree = {
376376
val manifestOpt = localTyper.findManifest(tp, false)
377-
if (!manifestOpt.tree.isEmpty) manifestOpt.tree
377+
// Don't want bottom types getting any further than this (SI-4024)
378+
if (tp.typeSymbol.isBottomClass) getManifest(AnyClass.tpe)
379+
else if (!manifestOpt.tree.isEmpty) manifestOpt.tree
378380
else if (tp.bounds.hi ne tp) getManifest(tp.bounds.hi)
379381
else localTyper.getManifestTree(tree.pos, tp, false)
380382
}

test/files/run/t4024.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,16 @@ object Test extends App {
55
val m = x.getClass.getMethod("toString")
66

77
assert(m.invoke(x, (Nil: List[AnyRef]): _*) == "abc")
8+
9+
Test2.main(Array())
810
}
911

12+
13+
object Test2 {
14+
def main(args: Array[String]): Unit = {
15+
val x = "abc"
16+
val m = x.getClass.getMethod("toString")
17+
m.invoke(x, Nil: _*)
18+
m.invoke(x, Seq(): _*)
19+
}
20+
}

0 commit comments

Comments
 (0)