diff options
author | Martin Odersky <odersky@gmail.com> | 2009-12-23 15:02:17 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-12-23 15:02:17 +0000 |
commit | 154326ab0c464bd10648b03998ea7a1700a572bb (patch) | |
tree | da054d009cb40644447b9c72d965610855a0f155 /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | 0cc326c7676844412ce0a2b5a3283a834041b86c (diff) | |
download | scala-154326ab0c464bd10648b03998ea7a1700a572bb.tar.gz scala-154326ab0c464bd10648b03998ea7a1700a572bb.tar.bz2 scala-154326ab0c464bd10648b03998ea7a1700a572bb.zip |
Weeds out stale symbols in typer.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index c43d9c8788..ec5ce91f3c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3534,12 +3534,27 @@ trait Typers { self: Analyzer => var pre: Type = NoPrefix // the prefix type of defSym, if a class member var qual: Tree = EmptyTree // the qualififier tree if transformed tree is a select - // if we are in a constructor of a pattern, ignore all definitions + // a symbol is stale if it is toplevel, to be loaded from a classfile, and + // the classfile is produced from a sourcefile which is compiled in the current run. + def isStale(sym: Symbol): Boolean = { + sym.owner.isPackageClass && + sym.rawInfo.isInstanceOf[loaders.ClassfileLoader] && { + sym.rawInfo.load(sym) + (sym.sourceFile ne null) && + (currentRun.compiledFiles contains sym.sourceFile) + } + } + + // A symbol qualifies if it exists and is not stale. Stale symbols + // are made to disappear here. In addition, + // if we are in a constructor of a pattern, we ignore all definitions // which are methods (note: if we don't do that // case x :: xs in class List would return the :: method). - def qualifies(sym: Symbol): Boolean = + def qualifies(sym: Symbol): Boolean = { + if (isStale(sym)) sym.setInfo(NoType) sym.exists && ((mode & PATTERNmode | FUNmode) != (PATTERNmode | FUNmode) || !sym.isSourceMethod) + } if (defSym == NoSymbol) { var defEntry: ScopeEntry = null // the scope entry of defSym, if defined in a local scope |