From 487e5bf895cde949c6c057e029c0bf96c6232431 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 11 Oct 2010 04:14:27 +0000 Subject: Better check for objects trying to sneak themse... Better check for objects trying to sneak themselves into the superconstructor arguments. Closes #3913, no review. --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 647e5e422d..3f4ff066d2 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1632,11 +1632,11 @@ trait Typers { self: Analyzer => // an object cannot be allowed to pass a reference to itself to a superconstructor // because of initialization issues; bug #473 - for { - arg <- superArgs - val sym = arg.symbol - if sym != null && sym.isModule && (sym.info.baseClasses contains clazz) - } error(rhs.pos, "super constructor cannot be passed a self reference unless parameter is declared by-name") + for (arg <- superArgs ; tree <- arg) { + val sym = tree.symbol + if (sym != null && sym.isModule && (sym.info.baseClasses contains clazz)) + error(rhs.pos, "super constructor cannot be passed a self reference unless parameter is declared by-name") + } if (superConstr.symbol.isPrimaryConstructor) { val superClazz = superConstr.symbol.owner -- cgit v1.2.3