summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-02-08 07:34:11 -0800
committerJames Iry <jamesiry@gmail.com>2013-02-08 07:34:11 -0800
commitc0d1bc4cc4cb2958af69305d286ff684306617a5 (patch)
treeaf67a07ac877e3e34fa4e227bf48786d300352d9 /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parentabc87e25d9a8030ed65677df9b41f302025c1717 (diff)
parent81fa8316092e295c1a893b6fcf65568c11fffb58 (diff)
downloadscala-c0d1bc4cc4cb2958af69305d286ff684306617a5.tar.gz
scala-c0d1bc4cc4cb2958af69305d286ff684306617a5.tar.bz2
scala-c0d1bc4cc4cb2958af69305d286ff684306617a5.zip
Merge pull request #2017 from retronym/ticket/6666
Booking more progress on SI-6666
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index ab338447c9..341dbfbe1f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -134,9 +134,12 @@ trait Namers extends MethodSynthesis {
def setPrivateWithin(tree: MemberDef, sym: Symbol): Symbol =
setPrivateWithin(tree, sym, tree.mods)
- def inConstructorFlag: Long =
- if (owner.isConstructor && !context.inConstructorSuffix || owner.isEarlyInitialized) INCONSTRUCTOR
- else 0l
+ def inConstructorFlag: Long = {
+ val termOwnedContexts: List[Context] = context.enclosingContextChain.takeWhile(_.owner.isTerm)
+ val constructorNonSuffix = termOwnedContexts exists (c => c.owner.isConstructor && !c.inConstructorSuffix)
+ val earlyInit = termOwnedContexts exists (_.owner.isEarlyInitialized)
+ if (constructorNonSuffix || earlyInit) INCONSTRUCTOR else 0L
+ }
def moduleClassFlags(moduleFlags: Long) =
(moduleFlags & ModuleToClassFlags) | inConstructorFlag