Skip to content

Commit e6441f1

Browse files
committed
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).
1 parent 57b91c5 commit e6441f1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4516,12 +4516,11 @@ trait Typers extends Modes with Adaptations with Tags {
45164516
// [Eugene] no more MaxArrayDims. ClassTags are flexible enough to allow creation of arrays of arbitrary dimensionality (w.r.t JVM restrictions)
45174517
val Some((level, componentType)) = erasure.GenericArray.unapply(tpt.tpe)
45184518
val tagType = List.iterate(componentType, level)(tpe => appliedType(ArrayClass.toTypeConstructor, List(tpe))).last
4519-
val newArrayApp = atPos(tree.pos) {
4519+
atPos(tree.pos) {
45204520
val tag = resolveClassTag(tree.pos, tagType)
45214521
if (tag.isEmpty) MissingClassTagError(tree, tagType)
4522-
else new ApplyToImplicitArgs(Select(tag, nme.newArray), args)
4522+
else typed(new ApplyToImplicitArgs(Select(tag, nme.newArray), args))
45234523
}
4524-
typed(newArrayApp, mode, pt)
45254524
case Apply(Select(fun, nme.apply), _) if treeInfo.isSuperConstrCall(fun) => //SI-5696
45264525
TooManyArgumentListsForConstructor(tree)
45274526
case tree1 =>

0 commit comments

Comments
 (0)