diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-07-16 09:45:59 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-07-16 09:45:59 +0200 |
commit | fe05bc9951f9e89bac59230932e50ec850df6ce4 (patch) | |
tree | 5a172633057267e3e74034d17f65659c4cbddfdb | |
parent | be1de605da16b8be3368f33196222befab5b5d6d (diff) | |
parent | 585cf5a2397210eb37cb01bf5a29771beef21412 (diff) | |
download | scala-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.scala | 2 | ||||
-rw-r--r-- | test/files/neg/t9401.check | 4 | ||||
-rw-r--r-- | test/files/neg/t9401.scala | 4 |
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) +} |