summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@typesafe.com>2015-07-16 09:45:59 +0200
committerLukas Rytz <lukas.rytz@typesafe.com>2015-07-16 09:45:59 +0200
commitfe05bc9951f9e89bac59230932e50ec850df6ce4 (patch)
tree5a172633057267e3e74034d17f65659c4cbddfdb
parentbe1de605da16b8be3368f33196222befab5b5d6d (diff)
parent585cf5a2397210eb37cb01bf5a29771beef21412 (diff)
downloadscala-fe05bc9951f9e89bac59230932e50ec850df6ce4.tar.gz
scala-fe05bc9951f9e89bac59230932e50ec850df6ce4.tar.bz2
scala-fe05bc9951f9e89bac59230932e50ec850df6ce4.zip
Merge pull request #4637 from retronym/ticket/9401
SI-9401 Avoid SOE with array + missing classtag
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--test/files/neg/t9401.check4
-rw-r--r--test/files/neg/t9401.scala4
3 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index b5129af9ec..fd1a6f293f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -4577,7 +4577,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
typed1(atPos(tree.pos)(Block(stats, Apply(expr, args) setPos tree.pos.makeTransparent)), mode, pt)
case Apply(fun, args) =>
normalTypedApply(tree, fun, args) match {
- case ArrayInstantiation(tree1) => typed(tree1, mode, pt)
+ case ArrayInstantiation(tree1) => if (tree1.isErrorTyped) tree1 else typed(tree1, mode, pt)
case Apply(Select(fun, nme.apply), _) if treeInfo.isSuperConstrCall(fun) => TooManyArgumentListsForConstructor(tree) //SI-5696
case tree1 => tree1
}
diff --git a/test/files/neg/t9401.check b/test/files/neg/t9401.check
new file mode 100644
index 0000000000..638d56db63
--- /dev/null
+++ b/test/files/neg/t9401.check
@@ -0,0 +1,4 @@
+t9401.scala:3: error: cannot find class tag for element type T
+ gencastarray = new Array[T](0)
+ ^
+one error found
diff --git a/test/files/neg/t9401.scala b/test/files/neg/t9401.scala
new file mode 100644
index 0000000000..f42ecc7f74
--- /dev/null
+++ b/test/files/neg/t9401.scala
@@ -0,0 +1,4 @@
+class Resetting[T] {
+ var gencastarray: Any = null
+ gencastarray = new Array[T](0)
+}