summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-11-30 09:00:53 +0100
committerEugene Burmako <xeno.by@gmail.com>2012-11-30 09:57:44 +0100
commite6441f16e8c85b43537f227e8e1a5d27a867a0ea (patch)
tree2ee01ac992a2973de508afe7171bcbba6a3301e3
parent57b91c5ee794cb8b66e298594a95a3fc829171f6 (diff)
downloadscala-e6441f16e8c85b43537f227e8e1a5d27a867a0ea.tar.gz
scala-e6441f16e8c85b43537f227e8e1a5d27a867a0ea.tar.bz2
scala-e6441f16e8c85b43537f227e8e1a5d27a867a0ea.zip
SI-6685 fixes error handling in typedApply
When MissingClassTagError doesn't lead to an exception, but rather silently sets an error, we need to bubble the resulting erroneous tree up the responsibility chain instead of mindlessly typechecking this again. This wasn't an issue before, because as far as I can guess the aforementioned error setter was always throwing exceptions in the most common usage scenarios (therefore the typecheck-again-fail-again vicious loop wasn't triggered).
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index d51ebc7d08..934ba91ac8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -4516,12 +4516,11 @@ trait Typers extends Modes with Adaptations with Tags {
// [Eugene] no more MaxArrayDims. ClassTags are flexible enough to allow creation of arrays of arbitrary dimensionality (w.r.t JVM restrictions)
val Some((level, componentType)) = erasure.GenericArray.unapply(tpt.tpe)
val tagType = List.iterate(componentType, level)(tpe => appliedType(ArrayClass.toTypeConstructor, List(tpe))).last
- val newArrayApp = atPos(tree.pos) {
+ atPos(tree.pos) {
val tag = resolveClassTag(tree.pos, tagType)
if (tag.isEmpty) MissingClassTagError(tree, tagType)
- else new ApplyToImplicitArgs(Select(tag, nme.newArray), args)
+ else typed(new ApplyToImplicitArgs(Select(tag, nme.newArray), args))
}
- typed(newArrayApp, mode, pt)
case Apply(Select(fun, nme.apply), _) if treeInfo.isSuperConstrCall(fun) => //SI-5696
TooManyArgumentListsForConstructor(tree)
case tree1 =>