diff options
Diffstat (limited to 'src')
14 files changed, 28 insertions, 26 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/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 8d810d456e..15d6a4d1b4 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1059,7 +1059,7 @@ self => def identOrMacro(): Name = if (isMacro) rawIdent() else ident() def selector(t: Tree): Tree = { - val point = in.offset + val point = if(isIdent) in.offset else in.lastOffset //SI-8459 //assert(t.pos.isDefined, t) if (t != EmptyTree) Select(t, ident(skipIt = false)) setPos r2p(t.pos.start, point, in.lastOffset) diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 37b00aa9a3..9433ddcf31 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -488,7 +488,8 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { val vparams = formalParams() if (!isVoid) rtpt = optArrayBrackets(rtpt) optThrows() - val bodyOk = !inInterface || (mods hasFlag Flags.DEFAULTMETHOD) + val isStatic = mods hasFlag Flags.STATIC + val bodyOk = !inInterface || ((mods hasFlag Flags.DEFAULTMETHOD) || isStatic) val body = if (bodyOk && in.token == LBRACE) { methodBody() @@ -507,7 +508,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { EmptyTree } } - if (inInterface) mods1 |= Flags.DEFERRED + if (inInterface && !isStatic) mods1 |= Flags.DEFERRED List { atPos(pos) { DefDef(mods1, name.toTermName, tparams, List(vparams), rtpt, body) 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/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 9b85f1b36a..3544dc9966 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -459,7 +459,7 @@ abstract class UnCurry extends InfoTransform case UnApply(fn, args) => val fn1 = transform(fn) val args1 = fn.symbol.name match { - case nme.unapplySeq => transformArgs(tree.pos, fn.symbol, args, patmat.alignPatterns(tree).expectedTypes) + case nme.unapplySeq => transformArgs(tree.pos, fn.symbol, args, patmat.alignPatterns(global.typer.context, tree).expectedTypes) case _ => args } treeCopy.UnApply(tree, fn1, args1) diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala index 0eaffe7cee..d862805a07 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala @@ -377,8 +377,8 @@ trait MatchTranslation { object ExtractorCall { // TODO: check unargs == args def apply(tree: Tree): ExtractorCall = tree match { - case UnApply(unfun, args) => new ExtractorCallRegular(alignPatterns(tree), unfun, args) // extractor - case Apply(fun, args) => new ExtractorCallProd(alignPatterns(tree), fun, args) // case class + case UnApply(unfun, args) => new ExtractorCallRegular(alignPatterns(context, tree), unfun, args) // extractor + case Apply(fun, args) => new ExtractorCallProd(alignPatterns(context, tree), fun, args) // case class } } diff --git a/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala b/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala index 8f21f4ecfc..79f5e3bee8 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala @@ -18,6 +18,7 @@ trait ScalacPatternExpanders { import global._ import definitions._ import treeInfo._ + import analyzer._ type PatternAligned = ScalacPatternExpander#Aligned @@ -94,7 +95,7 @@ trait ScalacPatternExpanders { def tupleExtractor(extractor: Extractor): Extractor = extractor.copy(fixed = tupleType(extractor.fixed) :: Nil) - private def validateAligned(tree: Tree, aligned: Aligned): Aligned = { + private def validateAligned(context: Context, tree: Tree, aligned: Aligned): Aligned = { import aligned._ def owner = tree.symbol.owner @@ -103,8 +104,8 @@ trait ScalacPatternExpanders { def offerString = if (extractor.isErroneous) "" else s" offering $offering" def arityExpected = ( if (extractor.hasSeq) "at least " else "" ) + productArity - def err(msg: String) = reporter.error(tree.pos, msg) - def warn(msg: String) = reporter.warning(tree.pos, msg) + def err(msg: String) = context.error(tree.pos, msg) + def warn(msg: String) = context.warning(tree.pos, msg) def arityError(what: String) = err(s"$what patterns for $owner$offerString: expected $arityExpected, found $totalArity") if (isStar && !isSeq) @@ -117,7 +118,7 @@ trait ScalacPatternExpanders { aligned } - def apply(sel: Tree, args: List[Tree]): Aligned = { + def apply(context: Context, sel: Tree, args: List[Tree]): Aligned = { val fn = sel match { case Unapplied(fn) => fn case _ => sel @@ -145,12 +146,12 @@ trait ScalacPatternExpanders { } val normalizedExtractor = if (requiresTupling) tupleExtractor(extractor) else extractor - validateAligned(fn, Aligned(patterns, normalizedExtractor)) + validateAligned(context, fn, Aligned(patterns, normalizedExtractor)) } - def apply(tree: Tree): Aligned = tree match { - case Apply(fn, args) => apply(fn, args) - case UnApply(fn, args) => apply(fn, args) + def apply(context: Context, tree: Tree): Aligned = tree match { + case Apply(fn, args) => apply(context, fn, args) + case UnApply(fn, args) => apply(context, fn, args) } } } diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala index da0e67a2a5..bb8c3c3c6d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala @@ -309,7 +309,7 @@ trait PatternTypers { // the union of the expected type and the inferred type of the argument to unapply val glbType = glb(ensureFullyDefined(pt) :: unapplyArg.tpe_* :: Nil) val wrapInTypeTest = canRemedy && !(fun1.symbol.owner isNonBottomSubClass ClassTagClass) - val formals = patmat.alignPatterns(fun1, args).unexpandedFormals + val formals = patmat.alignPatterns(context.asInstanceOf[analyzer.Context], fun1, args).unexpandedFormals val args1 = typedArgsForFormals(args, formals, mode) val result = UnApply(fun1, args1) setPos tree.pos setType glbType 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/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/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index f26315c538..a95f626a0b 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -2605,7 +2605,7 @@ trait Types // derived from the existentially quantified type into the typing environment // (aka \Gamma, which tracks types for variables and constraints/kinds for types) // as a nice bonus, delaying this until we need it avoids cyclic errors - def tpars = underlying.typeSymbol.initialize.typeParams + def tpars = underlying.typeSymbolDirect.initialize.typeParams def newSkolem(quant: Symbol) = owner.newExistentialSkolem(quant, origin) def newSharpenedSkolem(quant: Symbol, tparam: Symbol): Symbol = { |