Skip to content

Commit fe05bc9

Browse files
committed
Merge pull request scala#4637 from retronym/ticket/9401
SI-9401 Avoid SOE with array + missing classtag
2 parents be1de60 + 585cf5a commit fe05bc9

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/compiler/scala/tools/nsc/typechecker/Typers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4577,7 +4577,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
45774577
typed1(atPos(tree.pos)(Block(stats, Apply(expr, args) setPos tree.pos.makeTransparent)), mode, pt)
45784578
case Apply(fun, args) =>
45794579
normalTypedApply(tree, fun, args) match {
4580-
case ArrayInstantiation(tree1) => typed(tree1, mode, pt)
4580+
case ArrayInstantiation(tree1) => if (tree1.isErrorTyped) tree1 else typed(tree1, mode, pt)
45814581
case Apply(Select(fun, nme.apply), _) if treeInfo.isSuperConstrCall(fun) => TooManyArgumentListsForConstructor(tree) //SI-5696
45824582
case tree1 => tree1
45834583
}

test/files/neg/t9401.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
t9401.scala:3: error: cannot find class tag for element type T
2+
gencastarray = new Array[T](0)
3+
^
4+
one error found

test/files/neg/t9401.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Resetting[T] {
2+
var gencastarray: Any = null
3+
gencastarray = new Array[T](0)
4+
}

0 commit comments

Comments
 (0)