Permalink
Browse files

SI-5877 Tweak the check for package object owner.

Reuses existing function `isInPackageObject` and reads
better.
  • Loading branch information...
retronym committed Dec 4, 2012
1 parent 96e5c40 commit 0b1ae9cef4391775f0137332cc0cbd6136fe71b0
Showing with 4 additions and 3 deletions.
  1. +4 −3 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

0 comments on commit 0b1ae9c

Please sign in to comment.