summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Suereth <Joshua.Suereth@gmail.com>2012-07-30 07:12:50 -0700
committerJosh Suereth <Joshua.Suereth@gmail.com>2012-07-30 07:12:50 -0700
commitd1b7b24b0bfb808875339366a13ed00672767c16 (patch)
tree922967b8131bb51dc19fea1bf4b3c5492ff5f589
parent8e62dc93e2756db569fa00b50a80deba0fc1eece (diff)
parent54bab793ae6fbe3219efa8ef2e6a0015bbab7666 (diff)
downloadscala-d1b7b24b0bfb808875339366a13ed00672767c16.tar.gz
scala-d1b7b24b0bfb808875339366a13ed00672767c16.tar.bz2
scala-d1b7b24b0bfb808875339366a13ed00672767c16.zip
Merge pull request #998 from odersky/topic/bootpackages
Avoids loading scala.package and scala.reflect.package from source if a ...
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index 9b4e793241..46c52e68a2 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -112,11 +112,23 @@ abstract class SymbolLoaders {
enterClassAndModule(root, name, new SourcefileLoader(src))
}
+ /** The package objects of scala and scala.reflect should always
+ * be loaded in binary if classfiles are available, even if sourcefiles
+ * are newer. Late-compiling these objects from source leads to compilation
+ * order issues.
+ * Note: We do a name-base comparison here because the method is called before we even
+ * have ReflectPackage defined.
+ */
+ def binaryOnly(owner: Symbol, name: String): Boolean =
+ name == "package" &&
+ (owner.fullName == "scala" || owner.fullName == "scala.reflect")
+
/** Initialize toplevel class and module symbols in `owner` from class path representation `classRep`
*/
def initializeFromClassPath(owner: Symbol, classRep: ClassPath[platform.BinaryRepr]#ClassRep) {
((classRep.binary, classRep.source) : @unchecked) match {
- case (Some(bin), Some(src)) if platform.needCompile(bin, src) =>
+ case (Some(bin), Some(src))
+ if platform.needCompile(bin, src) && !binaryOnly(owner, classRep.name) =>
if (settings.verbose.value) inform("[symloader] picked up newer source file for " + src.path)
global.loaders.enterToplevelsFromSource(owner, classRep.name, src)
case (None, Some(src)) =>