diff options
author | Martin Odersky <odersky@gmail.com> | 2007-05-30 15:36:57 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-05-30 15:36:57 +0000 |
commit | 1cc6a768e075c0d764ae0625598b5d352ec1b4f2 (patch) | |
tree | 120dc52ad301cf2ed19296488723e6c527cde961 /src | |
parent | 2dcbfa7d08d1063757713d77ff39557a89be3014 (diff) | |
download | scala-1cc6a768e075c0d764ae0625598b5d352ec1b4f2.tar.gz scala-1cc6a768e075c0d764ae0625598b5d352ec1b4f2.tar.bz2 scala-1cc6a768e075c0d764ae0625598b5d352ec1b4f2.zip |
fixed bug 1123
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 21 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index e1ba10a064..aba9a20229 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -365,7 +365,7 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter else atPos(tree.pos)(outerPath(outerValue, currentClass.outerClass, sym)) // (5) case Select(qual, name) => - if (currentClass != sym.owner && currentClass != sym.moduleClass) // (3) + if (currentClass != sym.owner/* && currentClass != sym.moduleClass*/) // (3) sym.makeNotPrivate(sym.owner) val qsym = qual.tpe.widen.symbol if ((sym hasFlag PROTECTED) && //(4) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 93de2f5cb1..256244313a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -444,6 +444,13 @@ trait Typers requires Analyzer { typer1 } else this + /** Does the context of tree `tree' require a stable type? + */ + private def isStableContext(tree: Tree, mode: int, pt: Type) = + pt.isStable || + (mode & QUALmode) != 0 && !tree.symbol.isConstant || + pt.symbol.isAbstractType && pt.bounds.lo.isStable && !(tree.tpe <:< pt) + /** <p> * Post-process an identifier or selection node, performing the following: * </p> @@ -470,8 +477,8 @@ trait Typers requires Analyzer { errorTree(tree, sym+" is not a value") } else { if (sym.isStable && pre.isStable && tree.tpe.symbol != ByNameParamClass && - (pt.isStable || (mode & QUALmode) != 0 && !sym.isConstant || - sym.isModule && !sym.isMethod)) tree.setType(singleType(pre, sym)) + (isStableContext(tree, mode, pt) || sym.isModule && !sym.isMethod)) + tree.setType(singleType(pre, sym)) else tree } } @@ -489,8 +496,8 @@ trait Typers requires Analyzer { case _ => NoPrefix } if (tree.tpe.isInstanceOf[MethodType] && pre.isStable && sym.tpe.paramTypes.isEmpty && - (pt.isStable || (mode & QUALmode) != 0 && !sym.isConstant || sym.isModule)) - tree.setType(MethodType(List(), singleType(pre, sym))) + (isStableContext(tree, mode, pt) || sym.isModule)) + tree.setType(MethodType(List(), singleType(pre, sym))) else tree } @@ -2131,9 +2138,9 @@ trait Typers requires Analyzer { } if (clazz == NoSymbol) setError(tree) else { - val owntype = if (pt.isStable || (mode & QUALmode) != 0) selftype - else selftype.singleDeref - tree setSymbol clazz setType owntype + tree setSymbol clazz setType selftype.singleDeref + if (isStableContext(tree, mode, pt)) tree setType selftype + tree } } |