diff options
Diffstat (limited to 'src')
13 files changed, 44 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala index 59fefba954..bec686ec05 100644 --- a/src/compiler/scala/tools/nsc/Properties.scala +++ b/src/compiler/scala/tools/nsc/Properties.scala @@ -11,7 +11,7 @@ object Properties extends scala.util.PropertiesTrait { protected def propCategory = "compiler" protected def pickJarBasedOn = classOf[Global] - // settings based on jar properties + // settings based on jar properties, falling back to System prefixed by "scala." def residentPromptString = scalaPropOrElse("resident.prompt", "\nnsc> ") def shellPromptString = scalaPropOrElse("shell.prompt", "\nscala> ") def shellInterruptedString = scalaPropOrElse("shell.interrupted", ":quit\n") diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 2593903b9d..7c4c02c2d3 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -104,12 +104,14 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { if (settings.debug) inform("[running phase " + name + " on icode]") - if (settings.Xdce) - for ((sym, cls) <- icodes.classes if inliner.isClosureClass(sym) && !deadCode.liveClosures(sym)) { + if (settings.Xdce) { + val classes = icodes.classes.keys.toList // copy to avoid mutating the map while iterating + for (sym <- classes if inliner.isClosureClass(sym) && !deadCode.liveClosures(sym)) { log(s"Optimizer eliminated ${sym.fullNameString}") deadCode.elidedClosures += sym icodes.classes -= sym } + } // For predictably ordered error messages. var sortedClasses = classes.values.toList sortBy (_.symbol.fullName) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index d7cd92adf2..14be8374b9 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -352,7 +352,7 @@ abstract class ClassfileParser { } private def loadClassSymbol(name: Name): Symbol = { - val file = classPath findSourceFile ("" +name) getOrElse { + val file = classPath findClassFile ("" +name) getOrElse { // SI-5593 Scaladoc's current strategy is to visit all packages in search of user code that can be documented // therefore, it will rummage through the classpath triggering errors whenever it encounters package objects // that are not in their correct place (see bug for details) @@ -1047,7 +1047,7 @@ abstract class ClassfileParser { for (entry <- innerClasses.entries) { // create a new class member for immediate inner classes if (entry.outerName == currentClass) { - val file = classPath.findSourceFile(entry.externalName.toString) getOrElse { + val file = classPath.findClassFile(entry.externalName.toString) getOrElse { throw new AssertionError(entry.externalName) } enterClassAndModule(entry, file) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index 149b4fe446..cbe427775a 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -130,7 +130,7 @@ abstract class ICodeReader extends ClassfileParser { log("ICodeReader reading " + cls) val name = cls.javaClassName - classPath.findSourceFile(name) match { + classPath.findClassFile(name) match { case Some(classFile) => parse(classFile, cls) case _ => MissingRequirementError.notFound("Could not find bytecode for " + cls) } diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index a79f162140..eb29ccf4e1 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -480,6 +480,8 @@ trait Contexts { self: Analyzer => // SI-8245 `isLazy` need to skip lazy getters to ensure `return` binds to the right place c.enclMethod = if (isDefDef && !owner.isLazy) c else enclMethod + if (tree != outer.tree) c(TypeConstructorAllowed) = false + registerContext(c.asInstanceOf[analyzer.Context]) debuglog("[context] ++ " + c.unit + " / " + tree.summaryString) c diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index fdff2f3076..e876d4a6af 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1643,6 +1643,7 @@ trait Namers extends MethodSynthesis { def symbolAllowsDeferred = ( sym.isValueParameter || sym.isTypeParameterOrSkolem + || (sym.isAbstractType && sym.owner.isClass) || context.tree.isInstanceOf[ExistentialTypeTree] ) // Does the symbol owner require no undefined members? diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala index d2ba61cc0b..e89f08ec6b 100644 --- a/src/compiler/scala/tools/nsc/util/ClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala @@ -231,7 +231,7 @@ abstract class ClassPath[T] { classes find (_.name == name) } - def findSourceFile(name: String): Option[AbstractFile] = + def findClassFile(name: String): Option[AbstractFile] = findClass(name) match { case Some(ClassRep(Some(x: AbstractFile), _)) => Some(x) case _ => None diff --git a/src/interactive/scala/tools/nsc/interactive/tests/core/TestSettings.scala b/src/interactive/scala/tools/nsc/interactive/tests/core/TestSettings.scala index 681204172b..4962d80a8b 100644 --- a/src/interactive/scala/tools/nsc/interactive/tests/core/TestSettings.scala +++ b/src/interactive/scala/tools/nsc/interactive/tests/core/TestSettings.scala @@ -4,7 +4,7 @@ import scala.tools.nsc.io.Path /** Common settings for the test. */ private[tests] trait TestSettings { - protected final val TIMEOUT = 10000 // timeout in milliseconds + protected final val TIMEOUT = 30000 // timeout in milliseconds /** The root directory for this test suite, usually the test kind ("test/files/presentation"). */ protected val outDir = Path(Option(System.getProperty("partest.cwd")).getOrElse(".")) diff --git a/src/library/rootdoc.txt b/src/library/rootdoc.txt index 4795a47efe..e84942b8c4 100644 --- a/src/library/rootdoc.txt +++ b/src/library/rootdoc.txt @@ -12,7 +12,7 @@ Notable packages include: - [[scala.collection.immutable `scala.collection.immutable`]] - Immutable, sequential data-structures such as [[scala.collection.immutable.Vector `Vector`]], [[scala.collection.immutable.List `List`]], [[scala.collection.immutable.Range `Range`]], [[scala.collection.immutable.HashMap `HashMap`]] or - [[scala.collection.immutable.HashSet `HasSet`]] + [[scala.collection.immutable.HashSet `HashSet`]] - [[scala.collection.mutable `scala.collection.mutable`]] - Mutable, sequential data-structures such as [[scala.collection.mutable.ArrayBuffer `ArrayBuffer`]], [[scala.collection.mutable.StringBuilder `StringBuilder`]], diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala index b949bec48a..a6e538528a 100644 --- a/src/library/scala/collection/mutable/PriorityQueue.scala +++ b/src/library/scala/collection/mutable/PriorityQueue.scala @@ -16,6 +16,11 @@ import generic._ * To prioritize elements of type A there must be an implicit * Ordering[A] available at creation. * + * Only the `dequeue` and `dequeueAll` methods will return methods in priority + * order (while removing elements from the heap). Standard collection methods + * including `drop` and `iterator` will remove or traverse the heap in whichever + * order seems most convenient. + * * @tparam A type of the elements in this priority queue. * @param ord implicit ordering used to compare the elements of type `A`. * diff --git a/src/library/scala/util/Properties.scala b/src/library/scala/util/Properties.scala index 8835730d95..367488f116 100644 --- a/src/library/scala/util/Properties.scala +++ b/src/library/scala/util/Properties.scala @@ -62,10 +62,10 @@ private[scala] trait PropertiesTrait { def envOrSome(name: String, alt: Option[String]) = envOrNone(name) orElse alt - // for values based on propFilename - def scalaPropOrElse(name: String, alt: String): String = scalaProps.getProperty(name, alt) + // for values based on propFilename, falling back to System properties + def scalaPropOrElse(name: String, alt: String): String = scalaPropOrNone(name).getOrElse(alt) def scalaPropOrEmpty(name: String): String = scalaPropOrElse(name, "") - def scalaPropOrNone(name: String): Option[String] = Option(scalaProps.getProperty(name)) + def scalaPropOrNone(name: String): Option[String] = Option(scalaProps.getProperty(name)).orElse(propOrNone("scala." + name)) /** The numeric portion of the runtime Scala version, if this is a final * release. If for instance the versionString says "version 2.9.0.final", diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 44fce2c9ab..b0c23ef45d 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -2023,12 +2023,19 @@ trait Symbols extends api.Symbols { self: SymbolTable => info.decls.filter(sym => !sym.isMethod && sym.isParamAccessor).toList /** The symbol accessed by this accessor (getter or setter) function. */ - final def accessed: Symbol = accessed(owner.info) - - /** The symbol accessed by this accessor function, but with given owner type. */ - final def accessed(ownerTp: Type): Symbol = { + final def accessed: Symbol = { assert(hasAccessorFlag, this) - ownerTp decl localName + val localField = owner.info decl localName + + if (localField == NoSymbol && this.hasFlag(MIXEDIN)) { + // SI-8087: private[this] fields don't have a `localName`. When searching the accessed field + // for a mixin accessor of such a field, we need to look for `name` instead. + // The phase travel ensures that the field is found (`owner` is the trait class symbol, the + // field gets removed from there in later phases). + enteringPhase(picklerPhase)(owner.info).decl(name).suchThat(!_.isAccessor) + } else { + localField + } } /** The module corresponding to this module class (note that this diff --git a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala index 8d4c3f752f..5433bfad60 100644 --- a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala +++ b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala @@ -243,8 +243,14 @@ abstract class UnPickler { } getOrElse "") } + def localDummy = { + if (nme.isLocalDummyName(name)) + owner.newLocalDummy(NoPosition) + else NoSymbol + } + // (1) Try name. - fromName(name) orElse { + localDummy orElse fromName(name) orElse { // (2) Try with expanded name. Can happen if references to private // symbols are read from outside: for instance when checking the children // of a class. See #1722. @@ -298,6 +304,7 @@ abstract class UnPickler { * (.) ... * (1) `local child` represents local child classes, see comment in Pickler.putSymbol. * Since it is not a member, it should not be entered in the owner's scope. + * (2) Similarly, we ignore local dummy symbols, as seen in SI-8868 */ def shouldEnterInOwnerScope = { sym.owner.isClass && @@ -307,7 +314,8 @@ abstract class UnPickler { !sym.isRefinementClass && !sym.isTypeParameter && !sym.isExistentiallyBound && - sym.rawname != tpnme.LOCAL_CHILD // (1) + sym.rawname != tpnme.LOCAL_CHILD && // (1) + !nme.isLocalDummyName(sym.rawname) // (2) } markFlagsCompleted(sym)(mask = AllFlags) |