diff options
-rw-r--r-- | lib/scala-compiler.jar.desired.sha1 | 2 | ||||
-rw-r--r-- | lib/scala-library-src.jar.desired.sha1 | 2 | ||||
-rw-r--r-- | lib/scala-library.jar.desired.sha1 | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Interpreter.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Settings.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeInfo.scala | 7 | ||||
-rwxr-xr-x | src/compiler/scala/tools/nsc/javac/JavaParsers.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 6 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 50 | ||||
-rw-r--r-- | src/library/scala/List.scala | 2 | ||||
-rw-r--r-- | src/library/scala/concurrent/SyncVar.scala | 2 | ||||
-rw-r--r-- | src/library/scala/io/BufferedSource.scala | 3 | ||||
-rw-r--r-- | src/library/scala/xml/parsing/ConstructingParser.scala | 11 |
14 files changed, 51 insertions, 43 deletions
diff --git a/lib/scala-compiler.jar.desired.sha1 b/lib/scala-compiler.jar.desired.sha1 index 1cbceb25d0..ce9b06c06e 100644 --- a/lib/scala-compiler.jar.desired.sha1 +++ b/lib/scala-compiler.jar.desired.sha1 @@ -1 +1 @@ -6f096dd70f2faae10878c13b3fd6e6ee5a0a653a ?scala-compiler.jar +436474a1bef0763932e2748ff608a9aa2d40c528 ?scala-compiler.jar diff --git a/lib/scala-library-src.jar.desired.sha1 b/lib/scala-library-src.jar.desired.sha1 index 1fed7e186e..c87cc589ef 100644 --- a/lib/scala-library-src.jar.desired.sha1 +++ b/lib/scala-library-src.jar.desired.sha1 @@ -1 +1 @@ -0f69e8106c908ea61c826500b33a0dca70fb54de ?scala-library-src.jar +459731230e6c2f0fe3c89f8a7f1093c51b3c7e3a ?scala-library-src.jar diff --git a/lib/scala-library.jar.desired.sha1 b/lib/scala-library.jar.desired.sha1 index 07b9ed6442..69054d1d4f 100644 --- a/lib/scala-library.jar.desired.sha1 +++ b/lib/scala-library.jar.desired.sha1 @@ -1 +1 @@ -19c93a1d2d373bc98c93b83b29fef6f9b3d6ac23 ?scala-library.jar +7e0c0a761c9f6a9eb5d79d97c15db5664ea3fced ?scala-library.jar diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 5b5bc45d9f..fec56256fc 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -174,7 +174,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable try { val clazz = Class.forName(settings.sourceReader.value) val ccon = clazz.getConstructor(classOf[java.nio.charset.CharsetDecoder], classOf[Reporter]) - ccon.newInstance(charset.newDecoder(), reporter).asInstanceOf[SourceReader]; + ccon.newInstance(charset.newDecoder(), reporter).asInstanceOf[SourceReader] //new SourceReader(charset.newDecoder()) } catch { case e => diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index d4bb362871..58412908ae 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -550,7 +550,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) { var argsHolder: Array[Any] = null // this roundabout approach is to try and // make sure the value is boxed argsHolder = List(value).toArray - setterMethod.invoke(null, argsHolder.asInstanceOf[Array[AnyRef]] : _*) + setterMethod.invoke(null, argsHolder.asInstanceOf[Array[AnyRef]]: _*) interpret("val " + name + " = " + binderName + ".value") } diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala index ab9804d613..10c038badb 100644 --- a/src/compiler/scala/tools/nsc/Settings.scala +++ b/src/compiler/scala/tools/nsc/Settings.scala @@ -123,6 +123,7 @@ class Settings(error: String => Unit) { val Xshowobj = StringSetting ("-Xshow-object", "object", "Show object info", "").hideToIDE val showPhases = BooleanSetting ("-Xshow-phases", "Print a synopsis of compiler phases").hideToIDE val sourceReader = StringSetting ("-Xsource-reader", "classname", "Specify a custom method for reading source files", "scala.tools.nsc.io.SourceReader").hideToIDE +// val migrate2_7_2 = BooleanSetting ("-Xmigrate-to-2.7.2", "Issue warning messages to help in migration to 2.7.2") val Yhelp = BooleanSetting ("-Y", "Print a synopsis of private options").hideToIDE val browse = PhasesSetting ("-Ybrowse", "Browse the abstract syntax tree after") diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala index 48fdfe0f7f..76feeef0e2 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala @@ -203,6 +203,13 @@ abstract class TreeInfo { case _ => false } + /** Is this argument node of the form <expr> : _* ? + */ + def isWildcardStarArg(tree: Tree): Boolean = tree match { + case Typed(expr, Ident(name)) => name == nme.WILDCARD_STAR.toTypeName + case _ => false + } + /** Is this pattern node a catch-all (wildcard or variable) pattern? */ def isDefaultCase(cdef: CaseDef) = cdef match { case CaseDef(Ident(nme.WILDCARD), EmptyTree, _) => true diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 3d6c752128..72003d7b58 100755 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -483,7 +483,7 @@ trait JavaParsers extends JavaScanners { def termDecl(mods: Modifiers, parentToken: Int): List[Tree] = { val inInterface = parentToken == INTERFACE || parentToken == AT var mods1 = mods - if (mods hasFlag Flags.ABSTRACT) mods1 = mods &~ Flags.ABSTRACT | Flags.DEFERRED + if ((mods hasFlag Flags.ABSTRACT) || inInterface) mods1 = mods &~ Flags.ABSTRACT | Flags.DEFERRED val tparams = if (in.token == LT) typeParams() else List() val isVoid = in.token == VOID var rtpt = diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index fbfae15b15..2444cbea22 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -2363,14 +2363,12 @@ A type's typeSymbol should never be inspected directly. /** Map this function over given list of symbols */ def mapOver(origSyms: List[Symbol]): List[Symbol] = { - var change = false - val newInfos = for (sym <- origSyms) yield { + val change = origSyms exists { sym => val v = variance if (sym.isAliasType) variance = 0 val result = this(sym.info) - if (result ne sym.info) change = true variance = v - result + result ne sym.info } if (!change) origSyms // fast path in case nothing changes due to map else { // map is not the identity --> do cloning properly diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 49dacac6bc..bb6d9c17bb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1625,13 +1625,15 @@ trait Typers { self: Analyzer => !hasArrayElement(adaptedFormals(nonVarCount)) && !settings.XnoVarargsConversion.value) { val lastarg = typedArg(args(nonVarCount), mode, REGPATmode, WildcardType) - if (lastarg.tpe.typeSymbol == ArrayClass || lastarg.tpe.typeSymbol == AllRefClass) { - unit.warning( - lastarg.pos, - "I'm seeing an array passed into a Java vararg.\n"+ - "I assume that the elements of this array should be passed as individual arguments to the vararg.\n"+ - "Therefore I wrap the array in a `: _*', to mark it as a vararg argument.\n"+ - "If that's not what you want, compile this file with option -Xno-varargs-conversion.") + if ((lastarg.tpe.typeSymbol == ArrayClass || lastarg.tpe.typeSymbol == AllRefClass) && + !treeInfo.isWildcardStarArg(lastarg)) { + if (lastarg.tpe.typeSymbol == ArrayClass) + unit.warning( + lastarg.pos, + "I'm seeing an array passed into a Java vararg.\n"+ + "I assume that the elements of this array should be passed as individual arguments to the vararg.\n"+ + "Therefore I wrap the array in a `: _*', to mark it as a vararg argument.\n"+ + "If that's not what you want, compile this file with option -Xno-varargs-conversion.") args0 = args.init ::: List(gen.wildcardStar(args.last)) } } @@ -2062,6 +2064,7 @@ trait Typers { self: Analyzer => override def hashCode: Int = sym.hashCode * 41 + tp.hashCode } + /** convert skolems to existentials */ def packedType(tree: Tree, owner: Symbol): Type = { def defines(tree: Tree, sym: Symbol) = sym.isExistentialSkolem && sym.unpackLocation == tree || @@ -3117,23 +3120,24 @@ trait Typers { self: Analyzer => case Typed(expr, Function(List(), EmptyTree)) => typedEta(checkDead(typed1(expr, mode, pt))) - case Typed(expr, tpt @ Ident(name)) if (name == nme.WILDCARD_STAR.toTypeName) => - val expr1 = typed(expr, mode & stickyModes, seqType(pt)) - expr1.tpe.baseType(SeqClass) match { - case TypeRef(_, _, List(elemtp)) => - copy.Typed(tree, expr1, tpt setType elemtp) setType elemtp - case _ => - setError(tree) - } - case Typed(expr, tpt) => - val tpt1 = typedType(tpt) - val expr1 = typed(expr, mode & stickyModes, tpt1.tpe.deconst) - val owntype = - if ((mode & PATTERNmode) != 0) inferTypedPattern(tpt1.pos, tpt1.tpe, pt) - else tpt1.tpe - //Console.println(typed pattern: "+tree+":"+", tp = "+tpt1.tpe+", pt = "+pt+" ==> "+owntype)//DEBUG - copy.Typed(tree, expr1, tpt1) setType owntype + if (treeInfo.isWildcardStarArg(tree)) { + val expr1 = typed(expr, mode & stickyModes, seqType(pt)) + expr1.tpe.baseType(SeqClass) match { + case TypeRef(_, _, List(elemtp)) => + copy.Typed(tree, expr1, tpt setType elemtp) setType elemtp + case _ => + setError(tree) + } + } else { + val tpt1 = typedType(tpt) + val expr1 = typed(expr, mode & stickyModes, tpt1.tpe.deconst) + val owntype = + if ((mode & PATTERNmode) != 0) inferTypedPattern(tpt1.pos, tpt1.tpe, pt) + else tpt1.tpe + //Console.println(typed pattern: "+tree+":"+", tp = "+tpt1.tpe+", pt = "+pt+" ==> "+owntype)//DEBUG + copy.Typed(tree, expr1, tpt1) setType owntype + } case TypeApply(fun, args) => // @M: kind-arity checking is done here and in adapt, full kind-checking is in checkKindBounds (in Infer) diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala index 23667f68d7..287d552e34 100644 --- a/src/library/scala/List.scala +++ b/src/library/scala/List.scala @@ -442,7 +442,7 @@ object List { * @author Martin Odersky and others * @version 1.0, 16/07/2003 */ -sealed abstract class List[+A] extends Seq[A] { +sealed abstract class List[+A] extends Seq[A] with Product { /** Returns true if the list does not contain any elements. * @return <code>true</code>, iff the list is empty. diff --git a/src/library/scala/concurrent/SyncVar.scala b/src/library/scala/concurrent/SyncVar.scala index c04268990a..dfb619ca2a 100644 --- a/src/library/scala/concurrent/SyncVar.scala +++ b/src/library/scala/concurrent/SyncVar.scala @@ -52,7 +52,7 @@ class SyncVar[A] { /** * @deprecated Will be removed in 2.8. SyncVar should not allow exception by design. */ - def setWithCatch(x: => A) = synchronized { + @deprecated def setWithCatch(x: => A) = synchronized { try { this set x } catch { diff --git a/src/library/scala/io/BufferedSource.scala b/src/library/scala/io/BufferedSource.scala index 99d8d036ae..aca7ea3943 100644 --- a/src/library/scala/io/BufferedSource.scala +++ b/src/library/scala/io/BufferedSource.scala @@ -29,8 +29,9 @@ object BufferedSource { /** constructs a BufferedSource instance from an input stream, using given decoder */ def fromInputStream(inpStream: InputStream, decoder: CharsetDecoder, buffer_size: Int, do_reset: () => Source): BufferedSource = { val byteChannel = Channels.newChannel(inpStream) - return new BufferedSource(byteChannel, decoder) { + return new { val buf_size = buffer_size + } with BufferedSource(byteChannel, decoder) { override def reset = do_reset() def close { inpStream.close } } diff --git a/src/library/scala/xml/parsing/ConstructingParser.scala b/src/library/scala/xml/parsing/ConstructingParser.scala index 020b9892a0..adba52445d 100644 --- a/src/library/scala/xml/parsing/ConstructingParser.scala +++ b/src/library/scala/xml/parsing/ConstructingParser.scala @@ -53,15 +53,12 @@ object parseFromURL { } </pre> */ -class ConstructingParser(inp: Source, presWS:Boolean) -extends { val input = inp } -with ConstructingHandler -with ExternalSources -with MarkupParser { +class ConstructingParser(val input: Source, val preserveWS: Boolean) +extends ConstructingHandler +with ExternalSources +with MarkupParser { // default impl. of Logged override def log(msg: String): Unit = {} - - val preserveWS = presWS } |