Skip to content

Commit a55a64d

Browse files
authored
Merge pull request scala#10800 from lrytz/t13014
Skip analyzeSuperConstructor on erroneous trees
2 parents a0b7f6a + b5cf604 commit a55a64d

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,15 +2247,13 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
22472247
}
22482248

22492249
/** Analyze the super constructor call to record information used later to compute parameter aliases */
2250-
def analyzeSuperConstructor(meth: Symbol, vparamss: List[List[ValDef]], rhs: Tree): Unit = {
2250+
def analyzeSuperConstructor(meth: Symbol, vparamss: List[List[ValDef]], rhs: Tree): Unit = if (!rhs.isErrorTyped) {
22512251
val clazz = meth.owner
22522252
debuglog(s"computing param aliases for $clazz:${clazz.primaryConstructor.tpe}:$rhs")
22532253
val pending = ListBuffer[AbsTypeError]()
22542254

22552255
// !!! This method is redundant with other, less buggy ones.
22562256
def decompose(call: Tree): (Tree, List[Tree]) = call match {
2257-
case _ if call.isErrorTyped => // e.g. scala/bug#7636
2258-
(call, Nil)
22592257
case Apply(fn, args) =>
22602258
// an object cannot be allowed to pass a reference to itself to a superconstructor
22612259
// because of initialization issues; scala/bug#473, scala/bug#3913, scala/bug#6928.

test/files/neg/t13014.check

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
t13014.scala:2: error: could not find implicit value for parameter blup: String
2+
Error occurred in an application involving default arguments.
3+
class D extends C(y = 1)
4+
^
5+
1 error

test/files/neg/t13014.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class C(x: Int = 0, y: Int = 0)(implicit blup: String)
2+
class D extends C(y = 1)

0 commit comments

Comments
 (0)