diff options
author | Martin Odersky <odersky@gmail.com> | 2008-08-06 13:33:11 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-08-06 13:33:11 +0000 |
commit | 64d08622225906e5ad20b0deecd1c3d9c33a7ebb (patch) | |
tree | 6dd679e5908e91efa22ba5b03cc23cdf727fb5fa /src/compiler/scala/tools/nsc/typechecker/Contexts.scala | |
parent | 51f09101bb08a0d4e52ec4adb43bd72105e07e3d (diff) | |
download | scala-64d08622225906e5ad20b0deecd1c3d9c33a7ebb.tar.gz scala-64d08622225906e5ad20b0deecd1c3d9c33a7ebb.tar.bz2 scala-64d08622225906e5ad20b0deecd1c3d9c33a7ebb.zip |
Fixed #1130 and #1168
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 20eaa5fe29..bf7c3f564b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -122,11 +122,11 @@ trait Contexts { self: Analyzer => txt.scope = scope assert(outer ne this) // stupid txt.outer = outer // already interned - def f(what : Context) = + def fix(what : Context) = if (what eq this) txt else what - txt.enclClass = f(enclClass) - txt.enclMethod = f(enclMethod) + txt.enclClass = fix(enclClass) + txt.enclMethod = fix(enclMethod) txt.implicitsEnabled = implicitsEnabled txt.variance = variance txt._undetparams = _undetparams @@ -161,12 +161,12 @@ trait Contexts { self: Analyzer => } val a1 = eq(owner, that.owner) val a2 = eq(scope, that.scope) - def f(txt0 : Context, txt1 : Context) = + def fix(txt0 : Context, txt1 : Context) = ((this eq txt0) && (that eq txt1)) || (txt0 eq txt1) - val a3 = f(outer, that.outer) - val a4 = f(enclClass, that.enclClass) - val a5 = f(enclMethod, that.enclMethod) + val a3 = fix(outer, that.outer) + val a4 = fix(enclClass, that.enclClass) + val a5 = fix(enclMethod, that.enclMethod) val a6 = eq(variance, that.variance) val a7 = eq(_undetparams, that._undetparams) val a8 = eq(depth, that.depth) @@ -462,7 +462,7 @@ trait Contexts { self: Analyzer => (superAccess || (pre.widen.typeSymbol.isNonBottomSubClass(sym.owner) && (isSubClassOfEnclosing(pre.widen.typeSymbol) || phase.erasedTypes)))) - // note: phase.erasedTypes disables last test, because fater addinterfaces + // note: phase.erasedTypes disables last test, because after addinterfaces // implementation classes are not in the superclass chain. If we enable the // test, bug780 fails. } @@ -496,7 +496,7 @@ trait Contexts { self: Analyzer => implicitsCache = null if (outer != null && outer != this) outer.resetCache } - private def collectImplicits(syms: List[Symbol], pre: Type): List[ImplicitInfo] = + private def collectImplicits(syms: List[Symbol], pre: Type): List[ImplicitInfo] = { for (sym <- syms if sym.hasFlag(IMPLICIT) && isAccessible(sym, pre, false)) yield new ImplicitInfo(sym.name, pre, sym) @@ -534,7 +534,11 @@ trait Contexts { self: Analyzer => if (settings.debug.value) log("collect member implicits " + owner + ", implicit members = " + owner.thisType.implicitMembers)//debug - collectImplicits(owner.thisType.implicitMembers, owner.thisType) + val savedEnclClass = enclClass + this.enclClass = this + val res = collectImplicits(owner.thisType.implicitMembers, owner.thisType) + this.enclClass = savedEnclClass + res } else if (scope != nextOuter.scope && !owner.isPackageClass) { if (settings.debug.value) log("collect local implicits " + scope.toList)//debug |