summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-12-04 14:50:16 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-12-04 14:50:16 +0100
commit0b1ae9cef4391775f0137332cc0cbd6136fe71b0 (patch)
tree40bfc1fc9e9bfd1ab6b3fc141a58b18e6985114a
parent96e5c402a6d48de699fe48cd0eaf33d0575eaac7 (diff)
downloadscala-0b1ae9cef4391775f0137332cc0cbd6136fe71b0.tar.gz
scala-0b1ae9cef4391775f0137332cc0cbd6136fe71b0.tar.bz2
scala-0b1ae9cef4391775f0137332cc0cbd6136fe71b0.zip
SI-5877 Tweak the check for package object owner.
Reuses existing function `isInPackageObject` and reads better.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala7
1 files 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