From 0b1ae9cef4391775f0137332cc0cbd6136fe71b0 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 4 Dec 2012 14:50:16 +0100 Subject: SI-5877 Tweak the check for package object owner. Reuses existing function `isInPackageObject` and reads better. --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 9af72c1c00..e3f74a1a54 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2829,9 +2829,10 @@ trait Typers extends Modes with Adaptations with Tags { while (moreToAdd) { val initElems = scope.elems // SI-5877 The decls of a package include decls of the package object. But we don't want to add - // the corresponding synthetics to the package itself. - def isPackageObjectSym(sym: Symbol) = sym.owner.isPackageObjectClass && context.owner.isPackage - for (sym <- scope if !isPackageObjectSym(sym)) + // the corresponding synthetics to the package class, only to the package object class. + def shouldAdd(sym: Symbol) = + inBlock || !isInPackageObject(sym, context.owner) + for (sym <- scope if shouldAdd(sym)) for (tree <- context.unit.synthetics get sym) { newStats += typedStat(tree) // might add even more synthetics to the scope context.unit.synthetics -= sym -- cgit v1.2.3