summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-08-28 17:32:40 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-09-12 09:09:14 +0200
commit27d73ee7a92d8dd10d4d0598a29d3a3657053995 (patch)
treeb3596443308ef4b5e2aeb70cca731b8a480a56b9 /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parent38a488ea17e4ed42b65df4095c2eac738a63f5c4 (diff)
downloadscala-27d73ee7a92d8dd10d4d0598a29d3a3657053995.tar.gz
scala-27d73ee7a92d8dd10d4d0598a29d3a3657053995.tar.bz2
scala-27d73ee7a92d8dd10d4d0598a29d3a3657053995.zip
SI-7223 More finesse in setting INCONSTRUCTOR
It's a clunky flag used to determine very early on whether we're in the self-call, super-call or early-init section. In SI-6666 / fd6125428, the check was improved to consider nesting. But, that caused this regression, as Function's haven't been translated to classes yet, so our check for enclosing non-term owners failed wrongly flagged definitins body of a anonymous function as INCONSTRUCTOR. With this patch, we correctly flag: class C extends D { // INCONSTRUCTOR () => { !INCONSTRUCTOR } // INCONSTRUCTOR }
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 454f913412..9ac0b0835a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -135,7 +135,8 @@ trait Namers extends MethodSynthesis {
setPrivateWithin(tree, sym, tree.mods)
def inConstructorFlag: Long = {
- val termOwnedContexts: List[Context] = context.enclosingContextChain.takeWhile(_.owner.isTerm)
+ val termOwnedContexts: List[Context] =
+ context.enclosingContextChain.takeWhile(c => c.owner.isTerm && !c.owner.isAnonymousFunction)
val constructorNonSuffix = termOwnedContexts exists (c => c.owner.isConstructor && !c.inConstructorSuffix)
val earlyInit = termOwnedContexts exists (_.owner.isEarlyInitialized)
if (constructorNonSuffix || earlyInit) INCONSTRUCTOR else 0L