diff options
author | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-01-18 16:45:48 +0000 |
---|---|---|
committer | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-01-18 16:45:48 +0000 |
commit | 2cff99f2d2cff5a3e1b896177abbd2acda239744 (patch) | |
tree | 4e553e0c7d9d63dd6d8ecedaa8be51144db4308c | |
parent | 7aa371b39388bc510e9cd3f081b2019b09da0a63 (diff) | |
download | scala-2cff99f2d2cff5a3e1b896177abbd2acda239744.tar.gz scala-2cff99f2d2cff5a3e1b896177abbd2acda239744.tar.bz2 scala-2cff99f2d2cff5a3e1b896177abbd2acda239744.zip |
Merged revisions 20538-20539,20543-20544,20549,...
Merged revisions
20538-20539,20543-20544,20549,20555-20556,20559-20562,20564-20566 via
svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk
........
r20538 | extempore | 2010-01-15 19:00:51 +0100 (Fri, 15 Jan 2010) | 11 lines
Fix for #2365. Structural type mono and poly caches now wrap a soft
reference around cached classes so they do not interfere with garbage
collection. There is a test case, but it is in pending because I spent
longer trying to get it to fail under partest than I did writing
the actual patch. If you would like to see the behavior which was
corrected, go to
test/pending/run/bug2365
and run that script with scalac built before and after this commit.
Review by dubochet. ........ r20539 | extempore | 2010-01-15 20:48:57
+0100 (Fri, 15 Jan 2010) | 2 lines
Wrapped a buffered output stream around class file generation. This
has a nontrivial impact on total build time. Closes #2906. ........
r20543 | extempore | 2010-01-16 04:54:39 +0100 (Sat, 16 Jan 2010) | 2
lines
Exposed native Array clone() method. Closes #1051. Review by dragos.
........ r20544 | extempore | 2010-01-16 07:37:37 +0100 (Sat, 16 Jan
2010) | 2 lines
Made Iterator consistent with Iterable by adding grouped and sliding
to IterableLike. Closes #2837. Review by community. ........ r20549 |
extempore | 2010-01-16 22:52:44 +0100 (Sat, 16 Jan 2010) | 8 lines
New repl feature: you can start a line with . to invoke actions on the
previous result. For instance:
scala> (1 to 10).iterator
res0: Iterator[Int] = non-empty iterator
scala> .toList.sum
res1: Int = 55
........
r20555 | extempore | 2010-01-17 20:07:38 +0100 (Sun, 17 Jan 2010) | 2 lines
Brought ShowPickler somewhat more up to date with the current pickler
format. ........ r20556 | extempore | 2010-01-17 21:50:47 +0100 (Sun, 17
Jan 2010) | 2 lines
Don't insert whitespace on multiline strings and xml literals. Closes
#2115. No review. ........ r20559 | extempore | 2010-01-18 05:14:06
+0100 (Mon, 18 Jan 2010) | 1 line
Test case closes #1737. Review by community.
........
r20560 | extempore | 2010-01-18 05:14:25 +0100 (Mon, 18 Jan 2010) | 1 line
Fix and test case for #408. Review by community. ........ r20561 |
extempore | 2010-01-18 06:02:30 +0100 (Mon, 18 Jan 2010) | 4 lines
Adjectified some parts of speech as discussed on the mailing list. The
methods to call on FunctionN are "curried" and "tupled" with "curry"
deprecated and "tuple" gone. Closes #2907. Review by community. ........
r20562 | milessabin | 2010-01-18 13:20:57 +0100 (Mon, 18 Jan 2010) | 1
line
Fix and test case for #2891. No review necessary. ........ r20564 |
odersky | 2010-01-18 15:53:54 +0100 (Mon, 18 Jan 2010) | 1 line
cleaned up explicit tailcalls
........
r20565 | odersky | 2010-01-18 15:57:18 +0100 (Mon, 18 Jan 2010) | 1 line
some more performance tunings. No review.
........
r20566 | odersky | 2010-01-18 15:57:47 +0100 (Mon, 18 Jan 2010) | 1 line
new test. no review.
........
109 files changed, 807 insertions, 373 deletions
diff --git a/src/build/genprod.scala b/src/build/genprod.scala index ae2a3d7972..099c24ef20 100644 --- a/src/build/genprod.scala +++ b/src/build/genprod.scala @@ -209,37 +209,37 @@ trait {className}{contraCoArgs} extends AnyRef {{ self => List.map2(xdefs, targs)("(%s: %s) => ".format(_, _)).mkString("", "", body) } - // (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => self.apply(x1,x2,x3,x4,x5,x6,x7)).curry + // (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => self.apply(x1,x2,x3,x4,x5,x6,x7)).curried def longCurry = (List.map2(xdefs, targs)(_ + ": " + _) drop 1).mkString( "(x1: T1) => ((", ", ", - ") => self.apply%s).curry".format(commaXs) + ") => self.apply%s).curried".format(commaXs) ) - // f(x1,x2,x3,x4,x5,x6) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6) + // f(x1,x2,x3,x4,x5,x6) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6) def curryComment = { """ - /** f%s == (f.curry)%s + /** f%s == (f.curried)%s */ """.format(commaXs, xdefs map ("(" + _ + ")") mkString) } def tupleMethod = { def comment = """ - /* f%s == (f.tuple)(Tuple%d%s) + /* f%s == (f.tupled)(Tuple%d%s) */ """.format(commaXs, i, commaXs) def body = "case Tuple%d%s => apply%s".format(i, commaXs, commaXs) - comment + " def tuple: Tuple%d%s => R = {\n %s\n }\n".format(i, invariantArgs, body) + comment + " def tupled: Tuple%d%s => R = {\n %s\n }\n".format(i, invariantArgs, body) } def curryMethod = { val body = if (i < 5) shortCurry else longCurry curryComment + - " def curry: %s => R = {\n %s\n }\n".format( + " def curried: %s => R = {\n %s\n }\n".format( targs mkString " => ", body - ) + ) + """ @deprecated("Use 'curried' instead")""" + "\n def curry = curried\n" } override def moreMethods = curryMethod + tupleMethod diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index 1655c0130d..b2c5bc2415 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -185,12 +185,17 @@ class Interpreter(val settings: Settings, out: PrintWriter) /** Generates names pre0, pre1, etc. via calls to apply method */ class NameCreator(pre: String) { private var x = -1 + var mostRecent: String = null + def apply(): String = { x += 1 val name = pre + x.toString // make sure we don't overwrite their unwisely named res3 etc. - if (allBoundNames exists (_.toString == name)) apply() - else name + mostRecent = + if (allBoundNames exists (_.toString == name)) apply() + else name + + mostRecent } def reset(): Unit = x = -1 def didGenerate(name: String) = @@ -235,13 +240,18 @@ class Interpreter(val settings: Settings, out: PrintWriter) * This way, compiler error messages read better. */ private final val spaces = List.fill(7)(" ").mkString - def indentCode(code: String) = + def indentCode(code: String) = { + /** Heuristic to avoid indenting and thereby corrupting """-strings and XML literals. */ + val noIndent = (code contains "\n") && (List("\"\"\"", "</", "/>") exists (code contains _)) stringFrom(str => for (line <- code.lines) { - str.print(spaces) + if (!noIndent) + str.print(spaces) + str.print(line + "\n") str.flush() }) + } implicit def name2string(name: Name) = name.toString @@ -868,6 +878,18 @@ class Interpreter(val settings: Settings, out: PrintWriter) } } + /** Returns the name of the most recent interpreter result. + * Mostly this exists so you can conveniently invoke methods on + * the previous result. + */ + def mostRecentVar: String = + prevRequests.last.handlers.last.member match { + case x: ValOrDefDef => x.name + case Assign(Ident(name), _) => name + case ModuleDef(_, name, _) => name + case _ => varNameCreator.mostRecent + } + private def requestForName(name: Name): Option[Request] = { for (req <- prevRequests.toList.reverse) { if (req.handlers.exists(_.boundNames contains name)) diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala index 2b926d8e80..1a941342c4 100644 --- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala +++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala @@ -311,7 +311,7 @@ class InterpreterLoop(in0: Option[BufferedReader], out: PrintWriter) { def add(name: String, it: Iterator[String]) = if (it.hasNext) interpreter.bind(name, "scala.List[String]", it.toList) - List(("stdout", p.stdout), ("stderr", p.stderr)) foreach (add _).tuple + List(("stdout", p.stdout), ("stderr", p.stderr)) foreach (add _).tupled } def withFile(filename: String)(action: String => Unit) { @@ -342,7 +342,7 @@ class InterpreterLoop(in0: Option[BufferedReader], out: PrintWriter) { def power() { powerUserOn = true - interpreter.powerUser() + out println interpreter.powerUser() interpreter.quietBind("history", "scala.collection.immutable.List[String]", historyList.toList) } @@ -387,7 +387,8 @@ class InterpreterLoop(in0: Option[BufferedReader], out: PrintWriter) { * to be recorded for replay, if any. */ def interpretStartingWith(code: String): Option[String] = - interpreter.interpret(code) match { + if (code startsWith ".") interpretStartingWith(interpreter.mostRecentVar + code) + else interpreter.interpret(code) match { case IR.Error => None case IR.Success => Some(code) case IR.Incomplete => diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala index 3bd8c98664..157bc2dc1f 100644 --- a/src/compiler/scala/tools/nsc/Settings.scala +++ b/src/compiler/scala/tools/nsc/Settings.scala @@ -277,15 +277,15 @@ class Settings(errorFn: String => Unit) extends ScalacSettings { // A bit too clever, but I haven't found any other way to compose // functions with arity 2+ without having to annotate parameter types - lazy val IntSetting = untupled((sint _).tuple andThen add[IntSetting]) - lazy val BooleanSetting = untupled((bool _).tuple andThen add[BooleanSetting]) - lazy val StringSetting = untupled((str _).tuple andThen add[StringSetting]) - lazy val MultiStringSetting = untupled((multi _).tuple andThen add[MultiStringSetting]) - lazy val ChoiceSetting = untupled((choice _).tuple andThen add[ChoiceSetting]) - lazy val DebugSetting = untupled((sdebug _).tuple andThen add[DebugSetting]) - lazy val PhasesSetting = untupled((phase _).tuple andThen add[PhasesSetting]) + lazy val IntSetting = untupled((sint _).tupled andThen add[IntSetting]) + lazy val BooleanSetting = untupled((bool _).tupled andThen add[BooleanSetting]) + lazy val StringSetting = untupled((str _).tupled andThen add[StringSetting]) + lazy val MultiStringSetting = untupled((multi _).tupled andThen add[MultiStringSetting]) + lazy val ChoiceSetting = untupled((choice _).tupled andThen add[ChoiceSetting]) + lazy val DebugSetting = untupled((sdebug _).tupled andThen add[DebugSetting]) + lazy val PhasesSetting = untupled((phase _).tupled andThen add[PhasesSetting]) lazy val DefinesSetting = add(defines()) - lazy val OutputSetting = untupled((output _).tuple andThen add[OutputSetting]) + lazy val OutputSetting = untupled((output _).tupled andThen add[OutputSetting]) override def toString() = "Settings(\n%s)" format (settingSet filter (s => !s.isDefault) map (" " + _ + "\n") mkString) @@ -364,7 +364,7 @@ object Settings { singleOutDir match { case Some(d) => d case None => - (outputs find (isBelow _).tuple) match { + (outputs find (isBelow _).tupled) match { case Some((_, d)) => d case _ => throw new FatalError("Could not find an output directory for " @@ -397,7 +397,7 @@ object Settings { singleOutDir match { case Some(d) => Nil case None => - (outputs filter (isBelow _).tuple) match { + (outputs filter (isBelow _).tupled) match { case Nil => Nil case matches => matches.map(_._1.lookupPathUnchecked(srcPath, false)) } diff --git a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala index fb65f82740..a788015262 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala @@ -175,7 +175,10 @@ trait TreeDSL { if (target.tpe.typeSymbol == SomeClass) TRUE // is Some[_] else NOT(ID(target) DOT nme.isEmpty) // is Option[_] - def GET() = fn(ID(target), nme.get) + def IS_NULL() = REF(target) ANY_EQ NULL + def NOT_NULL() = REF(target) ANY_NE NULL + + def GET() = fn(REF(target), nme.get) // name of nth indexed argument to a method (first parameter list), defaults to 1st def ARG(idx: Int = 0) = Ident(target.paramss.head(idx)) diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala index c5a8b93c88..7f2bcf99c5 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala @@ -228,6 +228,9 @@ abstract class TreeGen def mkOr(tree1: Tree, tree2: Tree): Tree = Apply(Select(tree1, Boolean_or), List(tree2)) + // wrap the given expression in a SoftReference so it can be gc-ed + def mkSoftRef(expr: Tree): Tree = New(TypeTree(SoftReferenceClass.tpe), List(List(expr))) + def mkCached(cvar: Symbol, expr: Tree): Tree = { val cvarRef = if (cvar.owner.isClass) Select(This(cvar.owner), cvar) else Ident(cvar) Block( diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index b86356ba94..70d8c5d23f 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1237,7 +1237,7 @@ self => val npos = r2p(nstart, nstart, in.lastOffset) val tstart = in.offset val (parents, argss, self, stats) = template(false) - val cpos = r2p(tstart, tstart, in.lastOffset) + val cpos = r2p(tstart, tstart, in.lastOffset max tstart) makeNew(parents, self, stats, argss, npos, cpos) case _ => syntaxErrorOrIncomplete("illegal start of simple expression", true) diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 2f66f672d8..7f351293c5 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -730,16 +730,25 @@ abstract class GenICode extends SubComponent { else ctx ctx1 = genLoadArguments(args, sym.info.paramTypes, ctx1) - - val hostClass = fun match { - case Select(qualifier, _) - if (qualifier.tpe.typeSymbol != ArrayClass) => - qualifier.tpe.typeSymbol - case _ => sym.owner + val cm = CALL_METHOD(sym, invokeStyle) + + /** In a couple cases, squirrel away a little extra information in the + * CALL_METHOD for use by GenJVM. + */ + fun match { + case Select(qual, _) => + val qualSym = qual.tpe.typeSymbol + if (qualSym == ArrayClass) cm setTargetTypeKind toTypeKind(qual.tpe) + else cm setHostClass qualSym + + if (settings.debug.value) log( + if (qualSym == ArrayClass) "Stored target type kind " + toTypeKind(qual.tpe) + " for " + sym.fullNameString + else "Set more precise host class for " + sym.fullNameString + " host: " + qualSym + ) + case _ => } - if (settings.debug.value && hostClass != sym.owner) - log("Set more precise host class for " + sym.fullNameString + " host: " + hostClass); - ctx1.bb.emit(CALL_METHOD(sym, invokeStyle) setHostClass hostClass, tree.pos) + ctx1.bb.emit(cm, tree.pos) + if (sym == ctx1.method.symbol) { ctx1.method.recursive = true } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala index 9785279e80..f7baab286b 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala @@ -325,17 +325,20 @@ trait Opcodes { self: ICodes => var hostClass: Symbol = method.owner; def setHostClass(cls: Symbol): this.type = { hostClass = cls; this } - override def consumed = { - var result = method.tpe.paramTypes.length; - result = result + (style match { + /** This is specifically for preserving the target native Array type long + * enough that clone() can generate the right call. + */ + var targetTypeKind: TypeKind = UNIT // the default should never be used, so UNIT should fail fast. + def setTargetTypeKind(tk: TypeKind) = targetTypeKind = tk + + override def consumed = method.tpe.paramTypes.length + ( + style match { case Dynamic | InvokeDynamic => 1 case Static(true) => 1 case Static(false) => 0 case SuperCall(_) => 1 - }); - - result; - } + } + ) override def consumedTypes = { val args = method.tpe.paramTypes map toTypeKind diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 50e16dc6b8..7496107798 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -8,7 +8,7 @@ package scala.tools.nsc package backend.jvm -import java.io.{DataOutputStream, File, OutputStream} +import java.io.{ DataOutputStream, File, OutputStream } import java.nio.ByteBuffer import scala.collection.immutable.{Set, ListSet} @@ -82,6 +82,7 @@ abstract class GenJVM extends SubComponent { val StringBuilderType = new JObjectType(StringBuilderClass) val toStringType = new JMethodType(JObjectType.JAVA_LANG_STRING, JType.EMPTY_ARRAY) + val arrayCloneType = new JMethodType(JObjectType.JAVA_LANG_OBJECT, JType.EMPTY_ARRAY) val MethodTypeType = new JObjectType("java.dyn.MethodType") val JavaLangClassType = new JObjectType("java.lang.Class") val MethodHandleType = new JObjectType("java.dyn.MethodHandle") @@ -145,7 +146,7 @@ abstract class GenJVM extends SubComponent { addInnerClasses(jclass) val outfile = getFile(sym, jclass, ".class") - val outstream = new DataOutputStream(outfile.output) + val outstream = new DataOutputStream(outfile.bufferedOutput) jclass.writeTo(outstream) outstream.close() informProgress("wrote " + outfile) @@ -314,7 +315,7 @@ abstract class GenJVM extends SubComponent { // write the bean information class file. val outfile = getFile(c.symbol, beanInfoClass, ".class") - val outstream = new DataOutputStream(outfile.output) + val outstream = new DataOutputStream(outfile.bufferedOutput) beanInfoClass.writeTo(outstream) outstream.close() informProgress("wrote BeanInfo " + outfile) @@ -1087,6 +1088,11 @@ abstract class GenJVM extends SubComponent { case CALL_PRIMITIVE(primitive) => genPrimitive(primitive, instr.pos) + /** Special handling to access native Array.clone() */ + case call @ CALL_METHOD(definitions.Array_clone, Dynamic) => + val target: String = javaType(call.targetTypeKind).getSignature() + jcode.emitINVOKEVIRTUAL(target, "clone", arrayCloneType) + case call @ CALL_METHOD(method, style) => val owner: String = javaName(method.owner) // reference the type of the receiver instead of the method owner (if not an interface!) @@ -1820,8 +1826,6 @@ abstract class GenJVM extends SubComponent { dir.fileNamed(pathParts.last + suffix) } - - /** Merge adjacent ranges. */ private def mergeEntries(ranges: List[(Int, Int)]): List[(Int, Int)] = (ranges.foldLeft(Nil: List[(Int, Int)]) { (collapsed: List[(Int, Int)], p: (Int, Int)) => (collapsed, p) match { diff --git a/src/compiler/scala/tools/nsc/dependencies/Files.scala b/src/compiler/scala/tools/nsc/dependencies/Files.scala index 2165855ac9..09f694b6ca 100644 --- a/src/compiler/scala/tools/nsc/dependencies/Files.scala +++ b/src/compiler/scala/tools/nsc/dependencies/Files.scala @@ -150,7 +150,7 @@ trait Files { self : SubComponent => } def writeToFile[T](file: AbstractFile)(f: OutputStream => T) : T = { - val out = file.output + val out = file.bufferedOutput try { f(out) } finally { diff --git a/src/compiler/scala/tools/nsc/io/AbstractFile.scala b/src/compiler/scala/tools/nsc/io/AbstractFile.scala index 82116f3ca2..31073a0799 100644 --- a/src/compiler/scala/tools/nsc/io/AbstractFile.scala +++ b/src/compiler/scala/tools/nsc/io/AbstractFile.scala @@ -8,7 +8,7 @@ package scala.tools.nsc package io -import java.io.{ File => JFile, FileOutputStream, IOException, InputStream, OutputStream } +import java.io.{ File => JFile, FileOutputStream, IOException, InputStream, OutputStream, BufferedOutputStream } import java.net.URL import PartialFunction._ @@ -126,6 +126,9 @@ abstract class AbstractFile extends AnyRef with Iterable[AbstractFile] { /** Returns an output stream for writing the file */ def output: OutputStream + /** Returns an unbuffered output stream for writing the file - defaults to out */ + def bufferedOutput: BufferedOutputStream = new BufferedOutputStream(output) + /** size of this file if it is a concrete file. */ def sizeOption: Option[Int] = None diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index 7fce0ee73a..dda679e96e 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -621,7 +621,7 @@ trait ParallelMatching extends ast.TreeDSL def isNotAlternative(p: Pattern) = !cond(p.tree) { case _: Alternative => true } // classify all the top level patterns - alternatives come back unaltered - val newPats: List[Pattern] = pats.zipWithIndex map classifyPat.tuple + val newPats: List[Pattern] = pats.zipWithIndex map classifyPat.tupled // see if any alternatives were in there val (ps, others) = newPats span isNotAlternative // make a new row for each alternative, with it spliced into the original position diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index e1cf7a5a7e..155f5332d8 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -154,6 +154,7 @@ trait Definitions { def arrayApplyMethod = getMember(ScalaRunTimeModule, "array_apply") def arrayUpdateMethod = getMember(ScalaRunTimeModule, "array_update") def arrayLengthMethod = getMember(ScalaRunTimeModule, "array_length") + def arrayCloneMethod = getMember(ScalaRunTimeModule, "array_clone") // classes with special meanings lazy val NotNullClass = getClass("scala.NotNull") @@ -215,10 +216,13 @@ trait Definitions { def Array_apply = getMember(ArrayClass, nme.apply) def Array_update = getMember(ArrayClass, nme.update) def Array_length = getMember(ArrayClass, nme.length) + lazy val Array_clone = getMember(ArrayClass, nme.clone_) lazy val ArrayModule = getModule("scala.Array") def ArrayModule_apply = getMember(ArrayModule, nme.apply) // reflection / structural types + lazy val SoftReferenceClass = getClass("java.lang.ref.SoftReference") + lazy val WeakReferenceClass = getClass("java.lang.ref.WeakReference") lazy val MethodClass = getClass(sn.MethodAsObject) lazy val EmptyMethodCacheClass = getClass("scala.runtime.EmptyMethodCache") lazy val MethodCacheClass = getClass("scala.runtime.MethodCache") diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index c9aab59ff5..37ae9f35fe 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -504,13 +504,11 @@ trait Types { /** The info of `sym', seen as a member of this type. */ def memberInfo(sym: Symbol): Type = { - // incCounter(ctr1) sym.info.asSeenFrom(this, sym.owner) } /** The type of `sym', seen as a member of this type. */ def memberType(sym: Symbol): Type = { - // incCounter(ctr2) //@M don't prematurely instantiate higher-kinded types, they will be instantiated by transform, typedTypeApply, etc. when really necessary sym.tpeHK match { case ov @ OverloadedType(pre, alts) => @@ -584,12 +582,12 @@ trait Types { def stat_<:<(that: Type): Boolean = { incCounter(subtypeCount) -// val start = startTimer(subtypeNanos) + val start = startTimer(subtypeNanos) val result = (this eq that) || (if (explainSwitch) explain("<:", isSubType, this, that) else isSubType(this, that, AnyDepth)) -// stopTimer(subtypeNanos, start) + stopTimer(subtypeNanos, start) result } @@ -597,12 +595,12 @@ trait Types { */ def weak_<:<(that: Type): Boolean = { incCounter(subtypeCount) -// val start = startTimer(subtypeNanos) + val start = startTimer(subtypeNanos) val result = ((this eq that) || (if (explainSwitch) explain("weak_<:", isWeakSubType, this, that) else isWeakSubType(this, that))) -// stopTimer(subtypeNanos, start) + stopTimer(subtypeNanos, start) result } @@ -1301,15 +1299,16 @@ trait Types { def contributesAbstractMembers(p: Type) = p.deferredMembers exists isVisible - (parents exists (_.isVolatile)) || - (parents dropWhile (! _.typeSymbol.isAbstractType) match { - case ps @ (_ :: ps1) => - (ps ne parents) || - (ps1 exists contributesAbstractMembers) || - (decls.iterator exists (m => m.isDeferred && isVisible(m))) - case _ => - false - }) + ((parents exists (_.isVolatile)) + || + (parents dropWhile (! _.typeSymbol.isAbstractType) match { + case ps @ (_ :: ps1) => + (ps ne parents) || + (ps1 exists contributesAbstractMembers) || + (decls.iterator exists (m => m.isDeferred && isVisible(m))) + case _ => + false + })) } override def kind = "RefinedType" @@ -3739,12 +3738,12 @@ A type's typeSymbol should never be inspected directly. (beginsWithTypeVarOrIsRefined(pre1) || beginsWithTypeVarOrIsRefined(pre2)) && (pre1 =:= pre2) private def equalSymsAndPrefixes(sym1: Symbol, pre1: Type, sym2: Symbol, pre2: Type): Boolean = - if (sym1 == sym2) phase.erasedTypes || pre1 =:= pre2 + if (sym1 == sym2) sym1.hasFlag(PACKAGE) || phase.erasedTypes || pre1 =:= pre2 else (sym1.name == sym2.name) && isUnifiable(pre1, pre2) /** Do `tp1' and `tp2' denote equivalent types? */ - def isSameType(tp1: Type, tp2: Type): Boolean = { val start = startTimer(timer1); try { + def isSameType(tp1: Type, tp2: Type): Boolean = try { incCounter(sametypeCount) subsametypeRecursions += 1 undoLog undoUnless { @@ -3753,8 +3752,7 @@ A type's typeSymbol should never be inspected directly. } finally { subsametypeRecursions -= 1 if (subsametypeRecursions == 0) undoLog.clear - stopTimer(timer1, start) - }} + } def isDifferentType(tp1: Type, tp2: Type): Boolean = try { subsametypeRecursions += 1 @@ -3763,7 +3761,7 @@ A type's typeSymbol should never be inspected directly. } } finally { subsametypeRecursions -= 1 - if (subsametypeRecursions == 0) undoLog clear + if (subsametypeRecursions == 0) undoLog.clear } def isDifferentTypeConstructor(tp1: Type, tp2: Type): Boolean = tp1 match { @@ -3789,7 +3787,7 @@ A type's typeSymbol should never be inspected directly. case _ => tp.normalize } */ - +/* private def isSameType0(tp1: Type, tp2: Type): Boolean = { if (tp1 eq tp2) return true ((tp1, tp2) match { @@ -3894,7 +3892,7 @@ A type's typeSymbol should never be inspected directly. ((tp1n ne tp1) || (tp2n ne tp2)) && isSameType(tp1n, tp2n) } } - +*/ private def isSameType1(tp1: Type, tp2: Type): Boolean = { if ((tp1 eq tp2) || (tp1 eq ErrorType) || (tp1 eq WildcardType) || @@ -3925,27 +3923,27 @@ A type's typeSymbol should never be inspected directly. isSameTypes(tr1.args, tr2.args)) case _ => } - case ThisType(sym1) => + case tt1: ThisType => tp2 match { - case ThisType(sym2) => - if (sym1 == sym2) return true + case tt2: ThisType => + if (tt1.sym == tt2.sym) return true case _ => } - case SingleType(pre1, sym1) => + case st1: SingleType => tp2 match { - case SingleType(pre2, sym2) => - if (equalSymsAndPrefixes(sym1, pre1, sym2, pre2)) return true + case st2: SingleType => + if (equalSymsAndPrefixes(st1.sym, st1.pre, st2.sym, st2.pre)) return true case _ => } - case ConstantType(value1) => + case ct1: ConstantType => tp2 match { - case ConstantType(value2) => - return (value1 == value2) + case ct2: ConstantType => + return (ct1.value == ct2.value) case _ => } - case RefinedType(parents1, ref1) => + case rt1: RefinedType => tp2 match { - case RefinedType(parents2, ref2) => + case rt2: RefinedType => // def isSubScope(s1: Scope, s2: Scope): Boolean = s2.toList.forall { sym2 => var e1 = s1.lookupEntry(sym2.name) @@ -3960,16 +3958,19 @@ A type's typeSymbol should never be inspected directly. } } //Console.println("is same? " + tp1 + " " + tp2 + " " + tp1.typeSymbol.owner + " " + tp2.typeSymbol.owner)//DEBUG - return isSameTypes(parents1, parents2) && - isSubScope(ref1, ref2) && isSubScope(ref2, ref1) + return isSameTypes(rt1.parents, rt2.parents) && { + val decls1 = rt1.decls + val decls2 = rt2.decls + isSubScope(decls1, decls2) && isSubScope(decls2, decls1) + } case _ => } - case MethodType(params1, res1) => + case mt1: MethodType => tp2 match { - case MethodType(params2, res2) => + case mt2: MethodType => // new dependent types: probably fix this, use substSym as done for PolyType - return isSameTypes(tp1.paramTypes, tp2.paramTypes) && - res1 =:= res2 && + return isSameTypes(mt1.paramTypes, mt2.paramTypes) && + mt1.resultType =:= mt2.resultType && tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType] case _ => } @@ -4018,12 +4019,12 @@ A type's typeSymbol should never be inspected directly. case _ => } tp1 match { - case AnnotatedType(_,_,_) => + case _: AnnotatedType => return annotationsConform(tp1, tp2) && annotationsConform(tp2, tp1) && tp1.withoutAnnotations =:= tp2.withoutAnnotations case _ => } tp2 match { - case AnnotatedType(_,_,_) => + case _: AnnotatedType => return annotationsConform(tp1, tp2) && annotationsConform(tp2, tp1) && tp1.withoutAnnotations =:= tp2.withoutAnnotations case _ => } @@ -4284,16 +4285,18 @@ A type's typeSymbol should never be inspected directly. def thirdTry = tp2 match { case tr2: TypeRef => thirdTryRef(tp1, tr2) - case RefinedType(parents2, ref2) => - (parents2 forall (tp1 <:< _)) && - (ref2.toList forall tp1.specializes) - case et: ExistentialType => - et.withTypeVars(tp1 <:< _, depth) || fourthTry - case NotNullType(ntp2) => - tp1.isNotNull && tp1 <:< ntp2 - case MethodType(params2, res2) => + case rt2: RefinedType => + (rt2.parents forall (tp1 <:< _)) && + (rt2.decls.toList forall tp1.specializes) + case et2: ExistentialType => + et2.withTypeVars(tp1 <:< _, depth) || fourthTry + case nn2: NotNullType => + tp1.isNotNull && tp1 <:< nn2.underlying + case mt2: MethodType => tp1 match { case MethodType(params1, res1) => + val params2 = mt2.params + val res2 = mt2.resultType (params1.length == params2.length && matchingParams(params1, params2, tp1.isInstanceOf[JavaMethodType], tp2.isInstanceOf[JavaMethodType]) && (res1 <:< res2) && @@ -4301,11 +4304,11 @@ A type's typeSymbol should never be inspected directly. case _ => false } - case PolyType(List(), res2) => + case pt2 @ PolyType(List(), _) => tp1 match { - case PolyType(List(), res1) => + case pt1 @ PolyType(List(), _) => // other polytypes were already checked in isHKSubType - res1 <:< res2 + pt1.resultType <:< pt2.resultType case _ => false } @@ -4324,7 +4327,7 @@ A type's typeSymbol should never be inspected directly. * - handle typerefs, refined types, notnull and singleton types. */ def fourthTry = tp1 match { - case TypeRef(pre1, sym1, args1) => + case tr1 @ TypeRef(_, sym1, _) => if (sym1.isAliasType) { isSubType(tp1.normalize, tp2.normalize, depth) } else if (sym1.isAbstractType) { @@ -4340,14 +4343,14 @@ A type's typeSymbol should never be inspected directly. case _ => isSingleType(tp2) && tp1 <:< tp2.widen } - } else if (isRaw(sym1, args1)) { + } else if (isRaw(sym1, tr1.args)) { isSubType(rawToExistential(tp1), tp2, depth) } else if (sym1.isRefinementClass) { isSubType(sym1.info, tp2, depth) } else { false } - case RefinedType(parents1, ref1) => + case RefinedType(parents1, _) => parents1 exists (_ <:< tp2) case _: SingletonType | _: NotNullType => tp1.underlying <:< tp2 diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index cf217dcd23..81fe911328 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -52,27 +52,6 @@ abstract class CleanUp extends Transform with ast.TreeDSL { private def typedWithPos(pos: Position)(tree: Tree) = localTyper typed { atPos(pos)(tree) } - private def classConstantMethod(pos: Position, sig: String): Symbol = - classConstantMeth.getOrElseUpdate(sig, { - val forName = getMember(ClassClass.linkedModuleOfClass, nme.forName) - val owner = currentOwner.enclClass - - val cvar = owner.newVariable(pos, unit.fresh.newName(pos, "class$Cache")) - .setFlag(PRIVATE | STATIC | MUTABLE | SYNTHETIC).setInfo(ClassClass.tpe) - owner.info.decls enter cvar - val cdef = typedWithPos(pos) { VAL(cvar) === NULL } - - val meth = owner.newMethod(pos, unit.fresh.newName(pos, "class$Method")) - .setFlag(PRIVATE | STATIC | SYNTHETIC).setInfo(MethodType(List(), ClassClass.tpe)) - owner.info.decls enter meth - val mdef = typedWithPos(pos)(DEF(meth) === - gen.mkCached(cvar, Apply(REF(forName), List(Literal(sig)))) - ) - - newDefs.append(cdef, mdef) - meth - }) - override def transformUnit(unit: CompilationUnit) = unit.body = transform(unit.body) @@ -185,7 +164,8 @@ abstract class CleanUp extends Transform with ast.TreeDSL { case MONO_CACHE => - /* Implementation of the cache is as follows for method "def xyz(a: A, b: B)": + /* Implementation of the cache is as follows for method "def xyz(a: A, b: B)" + (but with a SoftReference wrapping reflClass$Cache, similarly in the poly Cache) : var reflParams$Cache: Array[Class[_]] = Array[JClass](classOf[A], classOf[B]) @@ -210,16 +190,19 @@ abstract class CleanUp extends Transform with ast.TreeDSL { addStaticVariableToClass("reflMethod$Cache", MethodClass.tpe, NULL, false) val reflClassCacheSym: Symbol = - addStaticVariableToClass("reflClass$Cache", ClassClass.tpe, NULL, false) + addStaticVariableToClass("reflClass$Cache", SoftReferenceClass.tpe, NULL, false) def getMethodSym = ClassClass.tpe member nme.getMethod_ + def isCacheEmpty(receiver: Symbol): Tree = + reflClassCacheSym.IS_NULL() OR (reflClassCacheSym.GET() ANY_NE REF(receiver)) + addStaticMethodToClass("reflMethod$Method", List(ClassClass.tpe), MethodClass.tpe) { case Pair(reflMethodSym, List(forReceiverSym)) => BLOCK( - IF (REF(reflClassCacheSym) ANY_NE REF(forReceiverSym)) THEN BLOCK( + IF (isCacheEmpty(forReceiverSym)) THEN BLOCK( REF(reflMethodCacheSym) === ((REF(forReceiverSym) DOT getMethodSym)(LIT(method), REF(reflParamsCacheSym))) , - REF(reflClassCacheSym) === REF(forReceiverSym), + REF(reflClassCacheSym) === gen.mkSoftRef(REF(forReceiverSym)), UNIT ) ENDIF, REF(reflMethodCacheSym) @@ -228,7 +211,10 @@ abstract class CleanUp extends Transform with ast.TreeDSL { case POLY_CACHE => - /* Implementation of the cache is as follows for method "def xyz(a: A, b: B)": + /* Implementation of the cache is as follows for method "def xyz(a: A, b: B)" + (but with the addition of a SoftReference wrapped around the MethodCache holder + so that it does not interfere with classloader garbage collection, see ticket + #2365 for details): var reflParams$Cache: Array[Class[_]] = Array[JClass](classOf[A], classOf[B]) @@ -250,23 +236,25 @@ abstract class CleanUp extends Transform with ast.TreeDSL { val reflParamsCacheSym: Symbol = addStaticVariableToClass("reflParams$Cache", theTypeClassArray, fromTypesToClassArrayLiteral(paramTypes), true) - val reflPolyCacheSym: Symbol = - addStaticVariableToClass("reflPoly$Cache", MethodCacheClass.tpe, NEW(TypeTree(EmptyMethodCacheClass.tpe)), false) + def mkNewPolyCache = gen.mkSoftRef(NEW(TypeTree(EmptyMethodCacheClass.tpe))) + val reflPolyCacheSym: Symbol = addStaticVariableToClass("reflPoly$Cache", SoftReferenceClass.tpe, mkNewPolyCache, false) + def getPolyCache = fn(REF(reflPolyCacheSym), nme.get) AS_ATTR MethodCacheClass.tpe addStaticMethodToClass("reflMethod$Method", List(ClassClass.tpe), MethodClass.tpe) { case Pair(reflMethodSym, List(forReceiverSym)) => val methodSym = reflMethodSym.newVariable(ad.pos, mkTerm("method")) setInfo MethodClass.tpe BLOCK( - VAL(methodSym) === ((REF(reflPolyCacheSym) DOT methodCache_find)(REF(forReceiverSym))) , + IF (getPolyCache ANY_EQ NULL) THEN (REF(reflPolyCacheSym) === mkNewPolyCache) ENDIF, + VAL(methodSym) === ((getPolyCache DOT methodCache_find)(REF(forReceiverSym))) , IF (REF(methodSym) OBJ_!= NULL) . THEN (Return(REF(methodSym))) ELSE { def methodSymRHS = ((REF(forReceiverSym) DOT Class_getMethod)(LIT(method), REF(reflParamsCacheSym))) - def cacheRHS = ((REF(reflPolyCacheSym) DOT methodCache_add)(REF(forReceiverSym), REF(methodSym))) + def cacheRHS = ((getPolyCache DOT methodCache_add)(REF(forReceiverSym), REF(methodSym))) BLOCK( REF(methodSym) === methodSymRHS, - REF(reflPolyCacheSym) === cacheRHS, + REF(reflPolyCacheSym) === gen.mkSoftRef(cacheRHS), Return(REF(methodSym)) ) } @@ -377,7 +365,8 @@ abstract class CleanUp extends Transform with ast.TreeDSL { def isArrayMethodSignature = (methSym.name == nme.length && params.isEmpty) || (methSym.name == nme.update && (structResType.typeSymbol eq UnitClass)) || - (methSym.name == nme.apply && params.size == 1) + (methSym.name == nme.apply && params.size == 1) || + (methSym.name == nme.clone_ && params.isEmpty) def isDefinitelyArray = isArrayMethodSignature && (qualSym == ArrayClass) def isMaybeArray = isArrayMethodSignature && (qualSym == ObjectClass) // precondition: !isDefinitelyArray @@ -386,6 +375,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL { case nme.length => REF(boxMethod(IntClass)) APPLY (REF(arrayLengthMethod) APPLY args) case nme.update => REF(arrayUpdateMethod) APPLY List(args(0), (REF(unboxMethod(IntClass)) APPLY args(1)), args(2)) case nme.apply => REF(arrayApplyMethod) APPLY List(args(0), (REF(unboxMethod(IntClass)) APPLY args(1))) + case nme.clone_ => REF(arrayCloneMethod) APPLY List(args(0)) } def genArrayTest = { def oneTest(s: Symbol) = qual IS_OBJ arrayType(s.tpe) diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index e92ba64469..7722939aaf 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -477,17 +477,6 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast. private def cast(tree: Tree, pt: Type): Tree = tree AS_ATTR pt - /** Is symbol a member of unboxed arrays (which will be expanded directly - * later)? - * - * @param sym .. - * @return <code>true</code> if .. - */ - private def isUnboxedArrayMember(sym: Symbol) = sym.name match { - case nme.apply | nme.length | nme.update => true - case _ => sym.owner == ObjectClass - } - private def isUnboxedValueMember(sym: Symbol) = sym != NoSymbol && isValueClass(sym.owner) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 515c7ad354..1d6f1bddac 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -17,6 +17,7 @@ import scala.tools.nsc.interactive.RangePositions import scala.tools.nsc.util.{ Position, Set, NoPosition, SourceFile, BatchSourceFile } import symtab.Flags._ +import util.Statistics import util.Statistics._ // Suggestion check whether we can do without priming scopes with symbols of outer scopes, @@ -297,7 +298,7 @@ trait Typers { self: Analyzer => val savedSTABLE = tree.symbol getFlag STABLE tree.symbol setInfo AnyRefClass.tpe tree.symbol setFlag STABLE - val result = treeInfo.isPureExpr(tree) + val result = treeInfo.isPureExpr(tree) tree.symbol setInfo savedTpe tree.symbol setFlag savedSTABLE result @@ -4068,6 +4069,14 @@ trait Typers { self: Analyzer => } try { + if (Statistics.enabled) { + val t = currentTime() + if (pendingTreeTypes.nonEmpty) { + microsByType(pendingTreeTypes.head) += ((t - typerTime) / 1000).toInt + } + typerTime = t + pendingTreeTypes = tree.getClass :: pendingTreeTypes + } if (context.retyping && (tree.tpe ne null) && (tree.tpe.isErroneous || !(tree.tpe <:< pt))) { tree.tpe = null @@ -4105,6 +4114,14 @@ trait Typers { self: Analyzer => Console.println("exception when typing "+tree+", pt = "+pt) throw ex */ //debug + } finally { + if (Statistics.enabled) { + val t = currentTime() + microsByType(pendingTreeTypes.head) += ((t - typerTime) / 1000).toInt + visitsByType(pendingTreeTypes.head) += 1 + typerTime = t + pendingTreeTypes = pendingTreeTypes.tail + } } } diff --git a/src/compiler/scala/tools/nsc/util/ShowPickled.scala b/src/compiler/scala/tools/nsc/util/ShowPickled.scala index b0dec01f33..1f181d36ed 100644 --- a/src/compiler/scala/tools/nsc/util/ShowPickled.scala +++ b/src/compiler/scala/tools/nsc/util/ShowPickled.scala @@ -41,6 +41,8 @@ object ShowPickled extends Names { case CLASSINFOtpe => "CLASSINFOtpe" case METHODtpe => "METHODtpe" case POLYtpe => "POLYtpe" + case IMPLICITMETHODtpe => "IMPLICITMETHODtpe" + case SUPERtpe => "SUPERtpe" case LITERALunit => "LITERALunit" case LITERALboolean => "LITERALboolean" case LITERALbyte => "LITERALbyte" @@ -53,7 +55,17 @@ object ShowPickled extends Names { case LITERALstring => "LITERALstring" case LITERALnull => "LITERALnull" case LITERALclass => "LITERALclass" + case LITERALenum => "LITERALenum" + case SYMANNOT => "SYMANNOT" case CHILDREN => "CHILDREN" + case ANNOTATEDtpe => "ANNOTATEDtpe" + case ANNOTINFO => "ANNOTINFO" + case ANNOTARGARRAY => "ANNOTARGARRAY" + case DEBRUIJNINDEXtpe => "DEBRUIJNINDEXtpe" + case EXISTENTIALtpe => "EXISTENTIALtpe" + case TREE => "TREE" + case MODIFIERS => "MODIFIERS" + case _ => "***BAD TAG***(" + tag + ")" } @@ -75,6 +87,9 @@ object ShowPickled extends Names { def printSymbolRef() = printNat() def printTypeRef() = printNat() def printConstantRef() = printNat() + def printAnnotInfoRef() = printNat() + def printConstAnnotArgRef() = printNat() + def printAnnotArgRef() = printNat() def printSymInfo() { printNameRef() @@ -85,6 +100,10 @@ object ShowPickled extends Names { printTypeRef() } + /** Note: the entries which require some semantic analysis to be correctly + * interpreted are for the most part going to tell you the wrong thing. + * It's not so easy to duplicate the logic applied in the UnPickler. + */ def printEntry(i: Int) { buf.readIndex = index(i) out.print(i + "," + buf.readIndex + ": ") @@ -144,18 +163,31 @@ object ShowPickled extends Names { out.print(" " + longBitsToDouble(buf.readLong(len))) case LITERALstring => printNameRef() + case LITERALenum => + printSymbolRef() case LITERALnull => out.print(" <null>") case LITERALclass => printTypeRef() case CHILDREN => printSymbolRef(); buf.until(end, printSymbolRef) + case SYMANNOT => + printSymbolRef(); printTypeRef(); buf.until(end, printAnnotArgRef) + case ANNOTATEDtpe => + printTypeRef(); buf.until(end, printAnnotInfoRef); + case ANNOTINFO => + printTypeRef(); buf.until(end, printAnnotArgRef) + case ANNOTARGARRAY => + buf.until(end, printConstAnnotArgRef) + case _ => } out.println() - if (buf.readIndex != end) - out.println("BAD ENTRY END: , computed = " + end + - ", factual = " + buf.readIndex) + if (buf.readIndex != end) { + out.println("BAD ENTRY END: computed = %d, actual = %d, bytes = %s".format( + end, buf.readIndex, buf.bytes.slice(index(i), (end max buf.readIndex)).mkString(", ") + )) + } } for (i <- 0 until index.length) printEntry(i) diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala index fd171c5a5e..afaaed7c7c 100644 --- a/src/library/scala/Array.scala +++ b/src/library/scala/Array.scala @@ -538,4 +538,12 @@ final class Array[T](_length: Int) { * <code>length <= i</code> */ def update(i: Int, x: T) { throw new Error() } + + /** <p> + * Clone the Array. + * </p> + * + * @return A clone of the Array. + */ + override def clone: Array[T] = throw new Error() } diff --git a/src/library/scala/Function.scala b/src/library/scala/Function.scala index 2c9772c526..0409d938fd 100644 --- a/src/library/scala/Function.scala +++ b/src/library/scala/Function.scala @@ -36,7 +36,7 @@ object Function * @param f ... * @return ... */ - @deprecated("Use `f.curry` instead") + @deprecated("Use `f.curried` instead") def curried[a1, a2, b](f: (a1, a2) => b): a1 => a2 => b = { x1 => x2 => f(x1, x2) } @@ -46,21 +46,21 @@ object Function * @param f ... * @return ... */ - @deprecated("Use `f.curry` instead") + @deprecated("Use `f.curried` instead") def curried[a1, a2, a3, b](f: (a1, a2, a3) => b): a1 => a2 => a3 => b = { x1 => x2 => x3 => f(x1, x2, x3) } /** Currying for functions of arity 4. */ - @deprecated("Use `f.curry` instead") + @deprecated("Use `f.curried` instead") def curried[a1, a2, a3, a4, b](f: (a1, a2, a3, a4) => b): a1 => a2 => a3 => a4 => b = { x1 => x2 => x3 => x4 => f(x1, x2, x3, x4) } /** Currying for functions of arity 5. */ - @deprecated("Use `f.curry` instead") + @deprecated("Use `f.curried` instead") def curried[a1, a2, a3, a4, a5, b](f: (a1, a2, a3, a4, a5) => b): a1 => a2 => a3 => a4 => a5 => b = { x1 => x2 => x3 => x4 => x5 => f(x1, x2, x3, x4, x5) } @@ -96,7 +96,7 @@ object Function * @param f ... * @return ... */ - @deprecated("Use `f.tuple` instead") + @deprecated("Use `f.tupled` instead") def tupled[a1, a2, b](f: (a1, a2) => b): Tuple2[a1, a2] => b = { case Tuple2(x1, x2) => f(x1, x2) } @@ -104,7 +104,7 @@ object Function /** Tupling for functions of arity 3. This transforms a function * of arity 3 into a unary function that takes a triple of arguments. */ - @deprecated("Use `f.tuple` instead") + @deprecated("Use `f.tupled` instead") def tupled[a1, a2, a3, b](f: (a1, a2, a3) => b): Tuple3[a1, a2, a3] => b = { case Tuple3(x1, x2, x3) => f(x1, x2, x3) } @@ -112,7 +112,7 @@ object Function /** Tupling for functions of arity 4. This transforms a function * of arity 4 into a unary function that takes a 4-tuple of arguments. */ - @deprecated("Use `f.tuple` instead") + @deprecated("Use `f.tupled` instead") def tupled[a1, a2, a3, a4, b](f: (a1, a2, a3, a4) => b): Tuple4[a1, a2, a3, a4] => b = { case Tuple4(x1, x2, x3, x4) => f(x1, x2, x3, x4) } @@ -120,7 +120,7 @@ object Function /** Tupling for functions of arity 5. This transforms a function * of arity 5 into a unary function that takes a 5-tuple of arguments. */ - @deprecated("Use `f.tuple` instead") + @deprecated("Use `f.tupled` instead") def tupled[a1, a2, a3, a4, a5, b](f: (a1, a2, a3, a4, a5) => b): Tuple5[a1, a2, a3, a4, a5] => b = { case Tuple5(x1, x2, x3, x4, x5) => f(x1, x2, x3, x4, x5) } diff --git a/src/library/scala/Function0.scala b/src/library/scala/Function0.scala index 27450789e2..74905d8af7 100644 --- a/src/library/scala/Function0.scala +++ b/src/library/scala/Function0.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with fancy comment) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with fancy comment) package scala diff --git a/src/library/scala/Function1.scala b/src/library/scala/Function1.scala index 4856891acf..75110d7d4e 100644 --- a/src/library/scala/Function1.scala +++ b/src/library/scala/Function1.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with fancy comment) (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with fancy comment) (with extra methods) package scala diff --git a/src/library/scala/Function10.scala b/src/library/scala/Function10.scala index 7e0e3dac09..8eb6fad84e 100644 --- a/src/library/scala/Function10.scala +++ b/src/library/scala/Function10.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function10[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, +R] extends def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10): R override def toString() = "<function10>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) == (f.tuple)(Tuple10(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) == (f.tupled)(Tuple10(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)) */ - def tuple: Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10] => R = { + def tupled: Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10] => R = { case Tuple10(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) } diff --git a/src/library/scala/Function11.scala b/src/library/scala/Function11.scala index 7877a30d24..7e94c6d2ca 100644 --- a/src/library/scala/Function11.scala +++ b/src/library/scala/Function11.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function11[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, +R] ex def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11): R override def toString() = "<function11>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) == (f.tuple)(Tuple11(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) == (f.tupled)(Tuple11(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11)) */ - def tuple: Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11] => R = { + def tupled: Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11] => R = { case Tuple11(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) } diff --git a/src/library/scala/Function12.scala b/src/library/scala/Function12.scala index 7bfc6b92f8..e14b95fc81 100644 --- a/src/library/scala/Function12.scala +++ b/src/library/scala/Function12.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function12[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12): R override def toString() = "<function12>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) == (f.tuple)(Tuple12(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) == (f.tupled)(Tuple12(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12)) */ - def tuple: Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12] => R = { + def tupled: Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12] => R = { case Tuple12(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) } diff --git a/src/library/scala/Function13.scala b/src/library/scala/Function13.scala index 18e29b5d13..2deeed8aa7 100644 --- a/src/library/scala/Function13.scala +++ b/src/library/scala/Function13.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function13[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12,v13:T13): R override def toString() = "<function13>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) == (f.tuple)(Tuple13(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) == (f.tupled)(Tuple13(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)) */ - def tuple: Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13] => R = { + def tupled: Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13] => R = { case Tuple13(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) } diff --git a/src/library/scala/Function14.scala b/src/library/scala/Function14.scala index 45bdeada72..596bbb25b8 100644 --- a/src/library/scala/Function14.scala +++ b/src/library/scala/Function14.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function14[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12,v13:T13,v14:T14): R override def toString() = "<function14>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) == (f.tuple)(Tuple14(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) == (f.tupled)(Tuple14(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14)) */ - def tuple: Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14] => R = { + def tupled: Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14] => R = { case Tuple14(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) } diff --git a/src/library/scala/Function15.scala b/src/library/scala/Function15.scala index 8778224e02..9942ab2015 100644 --- a/src/library/scala/Function15.scala +++ b/src/library/scala/Function15.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function15[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12,v13:T13,v14:T14,v15:T15): R override def toString() = "<function15>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) == (f.tuple)(Tuple15(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) == (f.tupled)(Tuple15(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15)) */ - def tuple: Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15] => R = { + def tupled: Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15] => R = { case Tuple15(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) } diff --git a/src/library/scala/Function16.scala b/src/library/scala/Function16.scala index 81a3077136..5419b40f8d 100644 --- a/src/library/scala/Function16.scala +++ b/src/library/scala/Function16.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function16[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12,v13:T13,v14:T14,v15:T15,v16:T16): R override def toString() = "<function16>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) == (f.tuple)(Tuple16(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) == (f.tupled)(Tuple16(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16)) */ - def tuple: Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16] => R = { + def tupled: Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16] => R = { case Tuple16(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) } diff --git a/src/library/scala/Function17.scala b/src/library/scala/Function17.scala index 42dfdf1c22..17caf47a02 100644 --- a/src/library/scala/Function17.scala +++ b/src/library/scala/Function17.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function17[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12,v13:T13,v14:T14,v15:T15,v16:T16,v17:T17): R override def toString() = "<function17>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) == (f.tuple)(Tuple17(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) == (f.tupled)(Tuple17(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)) */ - def tuple: Tuple17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17] => R = { + def tupled: Tuple17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17] => R = { case Tuple17(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) } diff --git a/src/library/scala/Function18.scala b/src/library/scala/Function18.scala index 91ea1849ff..338083ef17 100644 --- a/src/library/scala/Function18.scala +++ b/src/library/scala/Function18.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function18[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12,v13:T13,v14:T14,v15:T15,v16:T16,v17:T17,v18:T18): R override def toString() = "<function18>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17)(x18) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17)(x18) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18) == (f.tuple)(Tuple18(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18) == (f.tupled)(Tuple18(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18)) */ - def tuple: Tuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18] => R = { + def tupled: Tuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18] => R = { case Tuple18(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18) } diff --git a/src/library/scala/Function19.scala b/src/library/scala/Function19.scala index bbabac9c79..92eb2afa29 100644 --- a/src/library/scala/Function19.scala +++ b/src/library/scala/Function19.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function19[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12,v13:T13,v14:T14,v15:T15,v16:T16,v17:T17,v18:T18,v19:T19): R override def toString() = "<function19>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17)(x18)(x19) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17)(x18)(x19) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19) == (f.tuple)(Tuple19(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19) == (f.tupled)(Tuple19(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)) */ - def tuple: Tuple19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19] => R = { + def tupled: Tuple19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19] => R = { case Tuple19(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19) } diff --git a/src/library/scala/Function2.scala b/src/library/scala/Function2.scala index 21cc69a766..99c4ed1d2a 100644 --- a/src/library/scala/Function2.scala +++ b/src/library/scala/Function2.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with fancy comment) (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with fancy comment) (with extra methods) package scala @@ -39,15 +39,17 @@ trait Function2[-T1, -T2, +R] extends AnyRef { self => def apply(v1:T1,v2:T2): R override def toString() = "<function2>" - /** f(x1, x2) == (f.curry)(x1)(x2) + /** f(x1, x2) == (f.curried)(x1)(x2) */ - def curry: T1 => T2 => R = { + def curried: T1 => T2 => R = { (x1: T1) => (x2: T2) => apply(x1, x2) } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2) == (f.tuple)(Tuple2(x1, x2)) + /* f(x1, x2) == (f.tupled)(Tuple2(x1, x2)) */ - def tuple: Tuple2[T1, T2] => R = { + def tupled: Tuple2[T1, T2] => R = { case Tuple2(x1, x2) => apply(x1, x2) } diff --git a/src/library/scala/Function20.scala b/src/library/scala/Function20.scala index fda6d54f23..45636a1b7d 100644 --- a/src/library/scala/Function20.scala +++ b/src/library/scala/Function20.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function20[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12,v13:T13,v14:T14,v15:T15,v16:T16,v17:T17,v18:T18,v19:T19,v20:T20): R override def toString() = "<function20>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17)(x18)(x19)(x20) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17)(x18)(x19)(x20) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20) == (f.tuple)(Tuple20(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20) == (f.tupled)(Tuple20(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20)) */ - def tuple: Tuple20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20] => R = { + def tupled: Tuple20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20] => R = { case Tuple20(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20) } diff --git a/src/library/scala/Function21.scala b/src/library/scala/Function21.scala index 20d3582300..4463866a55 100644 --- a/src/library/scala/Function21.scala +++ b/src/library/scala/Function21.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function21[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12,v13:T13,v14:T14,v15:T15,v16:T16,v17:T17,v18:T18,v19:T19,v20:T20,v21:T21): R override def toString() = "<function21>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17)(x18)(x19)(x20)(x21) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17)(x18)(x19)(x20)(x21) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => T21 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20, x21: T21) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => T21 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20, x21: T21) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21) == (f.tuple)(Tuple21(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21) == (f.tupled)(Tuple21(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21)) */ - def tuple: Tuple21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21] => R = { + def tupled: Tuple21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21] => R = { case Tuple21(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21) } diff --git a/src/library/scala/Function22.scala b/src/library/scala/Function22.scala index 4dca9748cd..c148144ef4 100644 --- a/src/library/scala/Function22.scala +++ b/src/library/scala/Function22.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function22[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9,v10:T10,v11:T11,v12:T12,v13:T13,v14:T14,v15:T15,v16:T16,v17:T17,v18:T18,v19:T19,v20:T20,v21:T21,v22:T22): R override def toString() = "<function22>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17)(x18)(x19)(x20)(x21)(x22) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9)(x10)(x11)(x12)(x13)(x14)(x15)(x16)(x17)(x18)(x19)(x20)(x21)(x22) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => T21 => T22 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20, x21: T21, x22: T22) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => T21 => T22 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20, x21: T21, x22: T22) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22) == (f.tuple)(Tuple22(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22) == (f.tupled)(Tuple22(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22)) */ - def tuple: Tuple22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22] => R = { + def tupled: Tuple22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22] => R = { case Tuple22(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22) } diff --git a/src/library/scala/Function3.scala b/src/library/scala/Function3.scala index 5493716bd9..52c777fdc9 100644 --- a/src/library/scala/Function3.scala +++ b/src/library/scala/Function3.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function3[-T1, -T2, -T3, +R] extends AnyRef { self => def apply(v1:T1,v2:T2,v3:T3): R override def toString() = "<function3>" - /** f(x1, x2, x3) == (f.curry)(x1)(x2)(x3) + /** f(x1, x2, x3) == (f.curried)(x1)(x2)(x3) */ - def curry: T1 => T2 => T3 => R = { + def curried: T1 => T2 => T3 => R = { (x1: T1) => (x2: T2) => (x3: T3) => apply(x1, x2, x3) } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3) == (f.tuple)(Tuple3(x1, x2, x3)) + /* f(x1, x2, x3) == (f.tupled)(Tuple3(x1, x2, x3)) */ - def tuple: Tuple3[T1, T2, T3] => R = { + def tupled: Tuple3[T1, T2, T3] => R = { case Tuple3(x1, x2, x3) => apply(x1, x2, x3) } diff --git a/src/library/scala/Function4.scala b/src/library/scala/Function4.scala index fde16c8af8..79e92dc4e3 100644 --- a/src/library/scala/Function4.scala +++ b/src/library/scala/Function4.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function4[-T1, -T2, -T3, -T4, +R] extends AnyRef { self => def apply(v1:T1,v2:T2,v3:T3,v4:T4): R override def toString() = "<function4>" - /** f(x1, x2, x3, x4) == (f.curry)(x1)(x2)(x3)(x4) + /** f(x1, x2, x3, x4) == (f.curried)(x1)(x2)(x3)(x4) */ - def curry: T1 => T2 => T3 => T4 => R = { + def curried: T1 => T2 => T3 => T4 => R = { (x1: T1) => (x2: T2) => (x3: T3) => (x4: T4) => apply(x1, x2, x3, x4) } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4) == (f.tuple)(Tuple4(x1, x2, x3, x4)) + /* f(x1, x2, x3, x4) == (f.tupled)(Tuple4(x1, x2, x3, x4)) */ - def tuple: Tuple4[T1, T2, T3, T4] => R = { + def tupled: Tuple4[T1, T2, T3, T4] => R = { case Tuple4(x1, x2, x3, x4) => apply(x1, x2, x3, x4) } diff --git a/src/library/scala/Function5.scala b/src/library/scala/Function5.scala index 927cc7d942..af849300f4 100644 --- a/src/library/scala/Function5.scala +++ b/src/library/scala/Function5.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function5[-T1, -T2, -T3, -T4, -T5, +R] extends AnyRef { self => def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5): R override def toString() = "<function5>" - /** f(x1, x2, x3, x4, x5) == (f.curry)(x1)(x2)(x3)(x4)(x5) + /** f(x1, x2, x3, x4, x5) == (f.curried)(x1)(x2)(x3)(x4)(x5) */ - def curry: T1 => T2 => T3 => T4 => T5 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5) => self.apply(x1, x2, x3, x4, x5)).curry + def curried: T1 => T2 => T3 => T4 => T5 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5) => self.apply(x1, x2, x3, x4, x5)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5) == (f.tuple)(Tuple5(x1, x2, x3, x4, x5)) + /* f(x1, x2, x3, x4, x5) == (f.tupled)(Tuple5(x1, x2, x3, x4, x5)) */ - def tuple: Tuple5[T1, T2, T3, T4, T5] => R = { + def tupled: Tuple5[T1, T2, T3, T4, T5] => R = { case Tuple5(x1, x2, x3, x4, x5) => apply(x1, x2, x3, x4, x5) } diff --git a/src/library/scala/Function6.scala b/src/library/scala/Function6.scala index e2857647b0..487c650fc9 100644 --- a/src/library/scala/Function6.scala +++ b/src/library/scala/Function6.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function6[-T1, -T2, -T3, -T4, -T5, -T6, +R] extends AnyRef { self => def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6): R override def toString() = "<function6>" - /** f(x1, x2, x3, x4, x5, x6) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6) + /** f(x1, x2, x3, x4, x5, x6) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => self.apply(x1, x2, x3, x4, x5, x6)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => self.apply(x1, x2, x3, x4, x5, x6)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6) == (f.tuple)(Tuple6(x1, x2, x3, x4, x5, x6)) + /* f(x1, x2, x3, x4, x5, x6) == (f.tupled)(Tuple6(x1, x2, x3, x4, x5, x6)) */ - def tuple: Tuple6[T1, T2, T3, T4, T5, T6] => R = { + def tupled: Tuple6[T1, T2, T3, T4, T5, T6] => R = { case Tuple6(x1, x2, x3, x4, x5, x6) => apply(x1, x2, x3, x4, x5, x6) } diff --git a/src/library/scala/Function7.scala b/src/library/scala/Function7.scala index e3193f91b3..76de5c185c 100644 --- a/src/library/scala/Function7.scala +++ b/src/library/scala/Function7.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function7[-T1, -T2, -T3, -T4, -T5, -T6, -T7, +R] extends AnyRef { self => def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7): R override def toString() = "<function7>" - /** f(x1, x2, x3, x4, x5, x6, x7) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7) + /** f(x1, x2, x3, x4, x5, x6, x7) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => self.apply(x1, x2, x3, x4, x5, x6, x7)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => self.apply(x1, x2, x3, x4, x5, x6, x7)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7) == (f.tuple)(Tuple7(x1, x2, x3, x4, x5, x6, x7)) + /* f(x1, x2, x3, x4, x5, x6, x7) == (f.tupled)(Tuple7(x1, x2, x3, x4, x5, x6, x7)) */ - def tuple: Tuple7[T1, T2, T3, T4, T5, T6, T7] => R = { + def tupled: Tuple7[T1, T2, T3, T4, T5, T6, T7] => R = { case Tuple7(x1, x2, x3, x4, x5, x6, x7) => apply(x1, x2, x3, x4, x5, x6, x7) } diff --git a/src/library/scala/Function8.scala b/src/library/scala/Function8.scala index 3fb8ee458e..c8ca675365 100644 --- a/src/library/scala/Function8.scala +++ b/src/library/scala/Function8.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function8[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, +R] extends AnyRef { sel def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8): R override def toString() = "<function8>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8) + /** f(x1, x2, x3, x4, x5, x6, x7, x8) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8) == (f.tuple)(Tuple8(x1, x2, x3, x4, x5, x6, x7, x8)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8) == (f.tupled)(Tuple8(x1, x2, x3, x4, x5, x6, x7, x8)) */ - def tuple: Tuple8[T1, T2, T3, T4, T5, T6, T7, T8] => R = { + def tupled: Tuple8[T1, T2, T3, T4, T5, T6, T7, T8] => R = { case Tuple8(x1, x2, x3, x4, x5, x6, x7, x8) => apply(x1, x2, x3, x4, x5, x6, x7, x8) } diff --git a/src/library/scala/Function9.scala b/src/library/scala/Function9.scala index dc94f14348..338acbcae2 100644 --- a/src/library/scala/Function9.scala +++ b/src/library/scala/Function9.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Mon Nov 30 12:09:35 PST 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -23,15 +23,17 @@ trait Function9[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, +R] extends AnyRef def apply(v1:T1,v2:T2,v3:T3,v4:T4,v5:T5,v6:T6,v7:T7,v8:T8,v9:T9): R override def toString() = "<function9>" - /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9) == (f.curry)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9) + /** f(x1, x2, x3, x4, x5, x6, x7, x8, x9) == (f.curried)(x1)(x2)(x3)(x4)(x5)(x6)(x7)(x8)(x9) */ - def curry: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => R = { - (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9)).curry + def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => R = { + (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9)).curried } + @deprecated("Use 'curried' instead") + def curry = curried - /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9) == (f.tuple)(Tuple9(x1, x2, x3, x4, x5, x6, x7, x8, x9)) + /* f(x1, x2, x3, x4, x5, x6, x7, x8, x9) == (f.tupled)(Tuple9(x1, x2, x3, x4, x5, x6, x7, x8, x9)) */ - def tuple: Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9] => R = { + def tupled: Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9] => R = { case Tuple9(x1, x2, x3, x4, x5, x6, x7, x8, x9) => apply(x1, x2, x3, x4, x5, x6, x7, x8, x9) } diff --git a/src/library/scala/Product1.scala b/src/library/scala/Product1.scala index 4387d4dd8a..2cca5fe7d5 100644 --- a/src/library/scala/Product1.scala +++ b/src/library/scala/Product1.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product10.scala b/src/library/scala/Product10.scala index e776d7a0c4..a63a1007fb 100644 --- a/src/library/scala/Product10.scala +++ b/src/library/scala/Product10.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product11.scala b/src/library/scala/Product11.scala index ff7e572ff2..a33df77b64 100644 --- a/src/library/scala/Product11.scala +++ b/src/library/scala/Product11.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product12.scala b/src/library/scala/Product12.scala index b41c185da1..24b16876a3 100644 --- a/src/library/scala/Product12.scala +++ b/src/library/scala/Product12.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product13.scala b/src/library/scala/Product13.scala index 707aec63d8..1013561af6 100644 --- a/src/library/scala/Product13.scala +++ b/src/library/scala/Product13.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product14.scala b/src/library/scala/Product14.scala index 6e29529637..ddeccf7c98 100644 --- a/src/library/scala/Product14.scala +++ b/src/library/scala/Product14.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product15.scala b/src/library/scala/Product15.scala index f38432f6e9..0f25bda254 100644 --- a/src/library/scala/Product15.scala +++ b/src/library/scala/Product15.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product16.scala b/src/library/scala/Product16.scala index ff1477c509..1fcf2d192b 100644 --- a/src/library/scala/Product16.scala +++ b/src/library/scala/Product16.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product17.scala b/src/library/scala/Product17.scala index e5334cdf95..8c5efa9cc5 100644 --- a/src/library/scala/Product17.scala +++ b/src/library/scala/Product17.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product18.scala b/src/library/scala/Product18.scala index dbbdb81368..6ab150b1d1 100644 --- a/src/library/scala/Product18.scala +++ b/src/library/scala/Product18.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product19.scala b/src/library/scala/Product19.scala index c712fc6566..86fc2e43fb 100644 --- a/src/library/scala/Product19.scala +++ b/src/library/scala/Product19.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product2.scala b/src/library/scala/Product2.scala index 0b2751e3bc..27580f8658 100644 --- a/src/library/scala/Product2.scala +++ b/src/library/scala/Product2.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product20.scala b/src/library/scala/Product20.scala index 20f7ce7186..cc398f7bb4 100644 --- a/src/library/scala/Product20.scala +++ b/src/library/scala/Product20.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product21.scala b/src/library/scala/Product21.scala index 9c5215d640..b215c466ae 100644 --- a/src/library/scala/Product21.scala +++ b/src/library/scala/Product21.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product22.scala b/src/library/scala/Product22.scala index 7567a60547..f7e10a2652 100644 --- a/src/library/scala/Product22.scala +++ b/src/library/scala/Product22.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product3.scala b/src/library/scala/Product3.scala index 0e89c435a0..0fbd855b86 100644 --- a/src/library/scala/Product3.scala +++ b/src/library/scala/Product3.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product4.scala b/src/library/scala/Product4.scala index d581ce155b..efeec3c601 100644 --- a/src/library/scala/Product4.scala +++ b/src/library/scala/Product4.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product5.scala b/src/library/scala/Product5.scala index 734fe8c63f..64e59b6b1d 100644 --- a/src/library/scala/Product5.scala +++ b/src/library/scala/Product5.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product6.scala b/src/library/scala/Product6.scala index 0ea654dfa1..a2a819ef51 100644 --- a/src/library/scala/Product6.scala +++ b/src/library/scala/Product6.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product7.scala b/src/library/scala/Product7.scala index b7423a24ec..b9fa32bf00 100644 --- a/src/library/scala/Product7.scala +++ b/src/library/scala/Product7.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product8.scala b/src/library/scala/Product8.scala index 8eaa19c5b4..0f5aa6100a 100644 --- a/src/library/scala/Product8.scala +++ b/src/library/scala/Product8.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Product9.scala b/src/library/scala/Product9.scala index 37d6e5a311..6adce6023f 100644 --- a/src/library/scala/Product9.scala +++ b/src/library/scala/Product9.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Nov 04 18:46:21 CET 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple1.scala b/src/library/scala/Tuple1.scala index 4b36abdf41..d57c58fe78 100644 --- a/src/library/scala/Tuple1.scala +++ b/src/library/scala/Tuple1.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple10.scala b/src/library/scala/Tuple10.scala index ac3b8b6632..c9e38eec29 100644 --- a/src/library/scala/Tuple10.scala +++ b/src/library/scala/Tuple10.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple11.scala b/src/library/scala/Tuple11.scala index 6b5faadc18..546800f3af 100644 --- a/src/library/scala/Tuple11.scala +++ b/src/library/scala/Tuple11.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple12.scala b/src/library/scala/Tuple12.scala index edd91fc9da..0f2d4e9af0 100644 --- a/src/library/scala/Tuple12.scala +++ b/src/library/scala/Tuple12.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple13.scala b/src/library/scala/Tuple13.scala index f6714875a8..d9d540d334 100644 --- a/src/library/scala/Tuple13.scala +++ b/src/library/scala/Tuple13.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple14.scala b/src/library/scala/Tuple14.scala index 0a76401fcd..18ea35a9f4 100644 --- a/src/library/scala/Tuple14.scala +++ b/src/library/scala/Tuple14.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple15.scala b/src/library/scala/Tuple15.scala index a7a7973346..cb1742786c 100644 --- a/src/library/scala/Tuple15.scala +++ b/src/library/scala/Tuple15.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple16.scala b/src/library/scala/Tuple16.scala index fdcf4916d7..0af7feeb45 100644 --- a/src/library/scala/Tuple16.scala +++ b/src/library/scala/Tuple16.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple17.scala b/src/library/scala/Tuple17.scala index a1c906b781..ef02d51fc6 100644 --- a/src/library/scala/Tuple17.scala +++ b/src/library/scala/Tuple17.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple18.scala b/src/library/scala/Tuple18.scala index 1e1d8caab4..6f2489e41d 100644 --- a/src/library/scala/Tuple18.scala +++ b/src/library/scala/Tuple18.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple19.scala b/src/library/scala/Tuple19.scala index ed5e7945e0..ad69657e2c 100644 --- a/src/library/scala/Tuple19.scala +++ b/src/library/scala/Tuple19.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple2.scala b/src/library/scala/Tuple2.scala index c20f521afb..2a4797ab5a 100644 --- a/src/library/scala/Tuple2.scala +++ b/src/library/scala/Tuple2.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 (with extra methods) +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) package scala @@ -19,12 +19,10 @@ import scala.collection.generic.CanBuildFrom /** Tuple2 is the canonical representation of a @see Product2 * */ -case class Tuple2[+T1, +T2](_1:T1, _2:T2) extends Product2[T1, T2] { - override def toString() = { - val sb = new StringBuilder - sb.append('(').append(_1).append(',').append(_2).append(')') - sb.toString - } +case class Tuple2[+T1, +T2](_1:T1,_2:T2) + extends Product2[T1, T2] +{ + override def toString() = "(" + _1 + "," + _2 + ")" /** Swap the elements of the tuple */ def swap: Tuple2[T2,T1] = Tuple2(_2, _1) diff --git a/src/library/scala/Tuple20.scala b/src/library/scala/Tuple20.scala index 14821a5e9d..5f4d4b26e8 100644 --- a/src/library/scala/Tuple20.scala +++ b/src/library/scala/Tuple20.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple21.scala b/src/library/scala/Tuple21.scala index 43a78e0edb..780cbd15ad 100644 --- a/src/library/scala/Tuple21.scala +++ b/src/library/scala/Tuple21.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple22.scala b/src/library/scala/Tuple22.scala index b77a39c88c..f45cab85fa 100644 --- a/src/library/scala/Tuple22.scala +++ b/src/library/scala/Tuple22.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple3.scala b/src/library/scala/Tuple3.scala index 16314ee813..b70310db3f 100644 --- a/src/library/scala/Tuple3.scala +++ b/src/library/scala/Tuple3.scala @@ -8,14 +8,13 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala import scala.collection.{TraversableLike, IterableLike} import scala.collection.generic.CanBuildFrom - /** Tuple3 is the canonical representation of a @see Product3 * */ diff --git a/src/library/scala/Tuple4.scala b/src/library/scala/Tuple4.scala index 3beb3fbfcd..fbf5d341a4 100644 --- a/src/library/scala/Tuple4.scala +++ b/src/library/scala/Tuple4.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple5.scala b/src/library/scala/Tuple5.scala index 2cff721795..033f26263d 100644 --- a/src/library/scala/Tuple5.scala +++ b/src/library/scala/Tuple5.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple6.scala b/src/library/scala/Tuple6.scala index b0b539ffa0..d360adad2a 100644 --- a/src/library/scala/Tuple6.scala +++ b/src/library/scala/Tuple6.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple7.scala b/src/library/scala/Tuple7.scala index e440d721a0..5a080c2e0e 100644 --- a/src/library/scala/Tuple7.scala +++ b/src/library/scala/Tuple7.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple8.scala b/src/library/scala/Tuple8.scala index a8487513eb..551c5e5d34 100644 --- a/src/library/scala/Tuple8.scala +++ b/src/library/scala/Tuple8.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/Tuple9.scala b/src/library/scala/Tuple9.scala index df31eda6a8..8098daaf40 100644 --- a/src/library/scala/Tuple9.scala +++ b/src/library/scala/Tuple9.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Wed Jun 17 14:10:05 PDT 2009 +// generated by genprod on Sun Jan 17 19:38:09 PST 2010 package scala diff --git a/src/library/scala/collection/IterableLike.scala b/src/library/scala/collection/IterableLike.scala index 2e86b90479..8446988821 100644 --- a/src/library/scala/collection/IterableLike.scala +++ b/src/library/scala/collection/IterableLike.scala @@ -138,6 +138,38 @@ self => b.result } + /** Partitions elements in fixed size ${coll}s. + * @see Iterator#grouped + * + * @param size the number of elements per group + * @return An iterator producing ${coll}s of size `size`, except the + * last will be truncated if the elements don't divide evenly. + */ + def grouped(size: Int): Iterator[Repr] = + for (xs <- iterator grouped size) yield { + val b = newBuilder + b ++= xs + b.result + } + + /** Groups elements in fixed size blocks by passing a "sliding window" + * over them (as opposed to partitioning them, as is done in grouped.) + * @see Iterator#sliding + * + * @param size the number of elements per group + * @param step the distance between the first elements of successive + * groups (defaults to 1) + * @return An iterator producing ${coll}s of size `size`, except the + * last will be truncated if the elements don't divide evenly. + */ + def sliding[B >: A](size: Int): Iterator[Repr] = sliding(size, 1) + def sliding[B >: A](size: Int, step: Int): Iterator[Repr] = + for (xs <- iterator.sliding(size, step)) yield { + val b = newBuilder + b ++= xs + b.result + } + /** Selects last ''n'' elements. * $orderDependent * diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala index c23765c9bc..de0ec5275f 100644 --- a/src/library/scala/collection/Iterator.scala +++ b/src/library/scala/collection/Iterator.scala @@ -554,7 +554,7 @@ trait Iterator[+A] { self => * of the returned iterator is the maximum of the lengths of this iterator and `that`. * If this iterator is shorter than `that`, `thisElem` values are used to pad the result. * If `that` is shorter than this iterator, `thatElem` values are used to pad the result. - * @usecase def zipAll[B](that: Iterator[B], thisElem: A, thatElem: B): Iterator[(A, B1)] + * @usecase def zipAll[B](that: Iterator[B], thisElem: A, thatElem: B): Iterator[(A, B)] */ def zipAll[B, A1 >: A, B1 >: B](that: Iterator[B], thisElem: A1, thatElem: B1) = new Iterator[(A1, B1)] { def hasNext = self.hasNext || that.hasNext diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala index 25a8059b0c..2320187be9 100644 --- a/src/library/scala/collection/immutable/HashSet.scala +++ b/src/library/scala/collection/immutable/HashSet.scala @@ -115,17 +115,20 @@ class HashSet[A] extends Set[A] private def makeCopy(last: HashSet[A]) { def undo(m: HashSet[A]) { - if (m ne last) { - undo(m.later) - if (m.deleted) addEntry(m.changedElem) - else removeEntry(m.changedElem) - } + if (m.deleted) addEntry(m.changedElem) + else removeEntry(m.changedElem) } table = new scala.Array[AnyRef](last.table.length) scala.Array.copy(last.table, 0, table, 0, table.length) tableSize = last.tableSize threshold = last.threshold - undo(this) + + // we need to work from the end of the list but non-tail-recursion + // potentially blows the stack, so instead we create a stack on the heap. + // See ticket #408. + val toUndo = new mutable.Stack[HashSet[A]] + toUndo pushAll ((Iterator iterate this)(_.later) takeWhile (_ ne last)) + toUndo foreach undo later = null } diff --git a/src/library/scala/collection/mutable/WrappedArray.scala b/src/library/scala/collection/mutable/WrappedArray.scala index cedeb673e0..6652f5e40a 100644 --- a/src/library/scala/collection/mutable/WrappedArray.scala +++ b/src/library/scala/collection/mutable/WrappedArray.scala @@ -43,6 +43,9 @@ abstract class WrappedArray[T] extends IndexedSeq[T] with ArrayLike[T, WrappedAr def array: Array[T] override def stringPrefix = "WrappedArray" + /** Clones this object, including the underlying Array. */ + override def clone: WrappedArray[T] = WrappedArray make array.clone() + /** Creates new builder for this collection ==> move to subclasses */ override protected[this] def newBuilder: Builder[T, WrappedArray[T]] = @@ -50,7 +53,6 @@ abstract class WrappedArray[T] extends IndexedSeq[T] with ArrayLike[T, WrappedAr } object WrappedArray { - def make[T](x: AnyRef): WrappedArray[T] = x match { case x: Array[AnyRef] => wrapRefArray[AnyRef](x).asInstanceOf[WrappedArray[T]] case x: Array[Int] => wrapIntArray(x).asInstanceOf[WrappedArray[T]] diff --git a/src/library/scala/runtime/ArrayRuntime.java b/src/library/scala/runtime/ArrayRuntime.java new file mode 100644 index 0000000000..b382fdf8f6 --- /dev/null +++ b/src/library/scala/runtime/ArrayRuntime.java @@ -0,0 +1,16 @@ +package scala.runtime; + +/** + * Methods on Java arrays + */ +class ArrayRuntime { + static boolean[] cloneArray(boolean[] array) { return array.clone(); } + static byte[] cloneArray(byte[] array) { return array.clone(); } + static short[] cloneArray(short[] array) { return array.clone(); } + static char[] cloneArray(char[] array) { return array.clone(); } + static int[] cloneArray(int[] array) { return array.clone(); } + static long[] cloneArray(long[] array) { return array.clone(); } + static float[] cloneArray(float[] array) { return array.clone(); } + static double[] cloneArray(double[] array) { return array.clone(); } + static Object[] cloneArray(Object[] array) { return array.clone(); } +} diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index ecc81c074e..2f6ffb5535 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -74,6 +74,20 @@ object ScalaRunTime { case null => throw new NullPointerException } + def array_clone(xs: AnyRef): AnyRef = xs match { + case x: Array[AnyRef] => ArrayRuntime.cloneArray(x) + case x: Array[Int] => ArrayRuntime.cloneArray(x) + case x: Array[Double] => ArrayRuntime.cloneArray(x) + case x: Array[Long] => ArrayRuntime.cloneArray(x) + case x: Array[Float] => ArrayRuntime.cloneArray(x) + case x: Array[Char] => ArrayRuntime.cloneArray(x) + case x: Array[Byte] => ArrayRuntime.cloneArray(x) + case x: Array[Short] => ArrayRuntime.cloneArray(x) + case x: Array[Boolean] => ArrayRuntime.cloneArray(x) + case x: Array[Unit] => x + case null => throw new NullPointerException + } + /** Convert a numeric value array to an object array. * Needed to deal with vararg arguments of primtive types that are passed * to a generic Java vararg parameter T ... diff --git a/src/library/scala/util/control/TailCalls.scala b/src/library/scala/util/control/TailCalls.scala new file mode 100644 index 0000000000..59e9618028 --- /dev/null +++ b/src/library/scala/util/control/TailCalls.scala @@ -0,0 +1,56 @@ +package scala.util.control + +/** Methods exported by this object implement tail calls via trampolining. + * Tail calling methods have to return their result using `done` or call the next + * method using `tailcall`. Both return a `TailRec` object. The result of evaluating + * a tailcalling function can be retrieved from a `Tailrec` value using method result`. + * Here's a usage example: + * {{{ + * import scala.util.control.TailCalls._ + * + * def isEven(xs: List[Int]): TailRec[Boolean] = + * if (xs.isEmpty) done(true) else tailcall(isOdd(xs.tail)) + * + * def isOdd(xs: List[Int]): TailRec[Boolean] = + * if (xs.isEmpty) done(false) else tailcall(isEven(xs.tail)) + * + * isEven((1 to 100000).toList).result + * }}} + */ +object TailCalls { + + /** This class represents a tailcalling computation. + */ + abstract class TailRec[+A] { + /** Returns the result of the tailcalling computation + */ + def result: A = { + def loop(body: TailRec[A]): A = body match { + case Call(rest) => loop(rest()) + case Done(result) => result + } + loop(this) + } + } + + /** Internal class representing a tailcall */ + protected case class Call[A](rest: () => TailRec[A]) extends TailRec[A] + + /** Internal class representing the final result return from a tailcalling computation */ + protected case class Done[A](override val result: A) extends TailRec[A] + + /** Performs a tailcall + * @param rest the expression to be evaluated in the tailcall + * @return a `TailRec` object representing the expression `rest` + */ + def tailcall[A](rest: => TailRec[A]): TailRec[A] = new Call(() => rest) + + /** Used to return final result from tailcalling computation + * @param `result` the result value + * @return a `TailRec` object representing a computation which immediately returns `result` + */ + def done[A](result: A): TailRec[A] = new Done(result) + +} + + diff --git a/src/library/scala/util/control/TailRec.scala b/src/library/scala/util/control/TailRec.scala deleted file mode 100644 index db6cbfa2ed..0000000000 --- a/src/library/scala/util/control/TailRec.scala +++ /dev/null @@ -1,24 +0,0 @@ -package scala.util.control - -abstract class TailRec[+A] - -object TailRec { - - case class Call[A](rest: () => TailRec[A]) extends TailRec[A] - case class Done[A](result: A) extends TailRec[A] - - def tailcall[A](rest: => TailRec[A]) = new Call(() => rest) - def done [A](result: A) = new Done(result) - def trampoline[A](body: TailRec[A]): A = { - def loop(body: TailRec[A]): A = body match { - case Call(rest) => loop(rest()) - case Done(result) => result - } - loop(body) - } - def loop[A](body: TailRec[A]): A = body match { - case Call(rest) => loop[A](rest()) - case Done(result) => result - } -} - diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index e17cc15a0a..6c89318470 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -189,7 +189,7 @@ scala> scala> scala> | | | | res8: scala.xml.Elem = <a> - <b d="dd" c="c"></b></a> +<b d="dd" c="c"></b></a> scala> scala> @@ -199,9 +199,9 @@ scala> scala> scala> | | | res9: java.lang.String = - hello - there - +hello +there + scala> scala> | | You typed two blank lines. Starting a new command. diff --git a/test/files/neg/t2773.check b/test/files/neg/t2773.check new file mode 100644 index 0000000000..6e88762144 --- /dev/null +++ b/test/files/neg/t2773.check @@ -0,0 +1,7 @@ +t2773.scala:5: error: x is not a member of c + import c.x + ^ +t2773.scala:6: error: not found: value x + println(x) + ^ +two errors found diff --git a/test/files/neg/t2773.scala b/test/files/neg/t2773.scala new file mode 100755 index 0000000000..aaa6351c83 --- /dev/null +++ b/test/files/neg/t2773.scala @@ -0,0 +1,8 @@ +class C(x: Int) { def foo = x } + +object Test { + val c = new C(0) + import c.x + println(x) +} + diff --git a/test/files/pos/bug1737/A.java b/test/files/pos/bug1737/A.java new file mode 100644 index 0000000000..ee87e29a35 --- /dev/null +++ b/test/files/pos/bug1737/A.java @@ -0,0 +1,3 @@ +public interface A<T extends String> { + T get(); +}
\ No newline at end of file diff --git a/test/files/pos/bug1737/B.java b/test/files/pos/bug1737/B.java new file mode 100644 index 0000000000..28a1907a04 --- /dev/null +++ b/test/files/pos/bug1737/B.java @@ -0,0 +1 @@ +public abstract class B implements A {}
\ No newline at end of file diff --git a/test/files/pos/bug1737/c.scala b/test/files/pos/bug1737/c.scala new file mode 100644 index 0000000000..782ec18b9e --- /dev/null +++ b/test/files/pos/bug1737/c.scala @@ -0,0 +1,4 @@ +class C extends B { + this: A[_] => + def get = "foo" +}
\ No newline at end of file diff --git a/test/files/positions/New1.scala b/test/files/positions/New1.scala new file mode 100644 index 0000000000..bd17c0d523 --- /dev/null +++ b/test/files/positions/New1.scala @@ -0,0 +1,3 @@ +class New1 { + val a = new +} diff --git a/test/files/run/arrayclone.scala b/test/files/run/arrayclone.scala new file mode 100644 index 0000000000..2b56c53469 --- /dev/null +++ b/test/files/run/arrayclone.scala @@ -0,0 +1,106 @@ +object Test extends Application{ + BooleanArrayClone; + ByteArrayClone; + ShortArrayClone; + CharArrayClone; + IntArrayClone; + LongArrayClone; + FloatArrayClone; + DoubleArrayClone; + ObjectArrayClone; + PolymorphicArrayClone; +} + +object BooleanArrayClone{ + val it : Array[Boolean] = Array(true, false); + val cloned = it.clone(); + assert(cloned.sameElements(it)); + cloned(0) = false; + assert(it(0) == true) +} + +object ByteArrayClone{ + val it : Array[Byte] = Array(1, 0); + val cloned = it.clone(); + assert(cloned.sameElements(it)); + cloned(0) = 0; + assert(it(0) == 1) +} + +object ShortArrayClone{ + val it : Array[Short] = Array(1, 0); + val cloned = it.clone(); + assert(cloned.sameElements(it)); + cloned(0) = 0; + assert(it(0) == 1) +} + +object CharArrayClone{ + val it : Array[Char] = Array(1, 0); + val cloned = it.clone(); + assert(cloned.sameElements(it)); + cloned(0) = 0; + assert(it(0) == 1) +} + +object IntArrayClone{ + val it : Array[Int] = Array(1, 0); + val cloned = it.clone(); + assert(cloned.sameElements(it)); + cloned(0) = 0; + assert(it(0) == 1) +} + +object LongArrayClone{ + val it : Array[Long] = Array(1, 0); + val cloned = it.clone(); + assert(cloned.sameElements(it)); + cloned(0) = 0; + assert(it(0) == 1) +} + +object FloatArrayClone{ + val it : Array[Float] = Array(1, 0); + val cloned = it.clone(); + assert(cloned.sameElements(it)); + cloned(0) = 0; + assert(it(0) == 1) +} + +object DoubleArrayClone{ + val it : Array[Double] = Array(1, 0); + val cloned = it.clone(); + assert(cloned.sameElements(it)); + cloned(0) = 0; + assert(it(0) == 1) +} + +object ObjectArrayClone{ + val it : Array[String] = Array("1", "0"); + val cloned = it.clone(); + assert(cloned.sameElements(it)); + cloned(0) = "0"; + assert(it(0) == "1") +} + +object PolymorphicArrayClone{ + def testIt[T](it : Array[T], one : T, zero : T) = { + val cloned = it.clone(); + assert(cloned.sameElements(it)); + cloned(0) = zero; + assert(it(0) == one) + } + + testIt(Array("one", "two"), "one", "two"); + + class Mangler[T: Manifest](ts : T*){ + // this will always be a BoxedAnyArray even after we've unboxed its contents. + val it = ts.toArray[T]; + } + + val mangled = new Mangler[Int](0, 1); + + val y : Array[Int] = mangled.it; // make sure it's unboxed + + testIt(mangled.it, 0, 1); +} diff --git a/test/files/run/bug408.scala b/test/files/run/bug408.scala new file mode 100644 index 0000000000..9e51e881ed --- /dev/null +++ b/test/files/run/bug408.scala @@ -0,0 +1,12 @@ +object Test +{ + val a = scala.collection.immutable.Set.empty ++ (0 to 100000) + val b = scala.collection.immutable.Set.empty ++ (0 to 100000) + + def main(args: Array[String]): Unit = { + a -- b + a -- b + a -- b + a -- b + } +} diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala index 7f40277d4d..2d136b5708 100644 --- a/test/files/run/tailcalls.scala +++ b/test/files/run/tailcalls.scala @@ -381,6 +381,18 @@ object Test { check_success("PolyObject.tramp", PolyObject.tramp[Int](max), 0) } + // testing explicit tailcalls. + + import scala.util.control.TailCalls._ + + def isEven(xs: List[Int]): TailRec[Boolean] = + if (xs.isEmpty) done(true) else tailcall(isOdd(xs.tail)) + + def isOdd(xs: List[Int]): TailRec[Boolean] = + if (xs.isEmpty) done(false) else tailcall(isEven(xs.tail)) + + assert(isEven((1 to 100000).toList).result) + } //############################################################################ diff --git a/test/pending/run/bug2365/Test.scala b/test/pending/run/bug2365/Test.scala new file mode 100644 index 0000000000..92b58f4a25 --- /dev/null +++ b/test/pending/run/bug2365/Test.scala @@ -0,0 +1,35 @@ +import scala.tools.nsc.io._ +import java.net.URL + +object A { def apply(d: { def apply(): Int}) = d.apply() } +object A2 { def apply(d: { def apply(): Int}) = d.apply() } +object A3 { def apply(d: { def apply(): Int}) = d.apply() } +object A4 { def apply(d: { def apply(): Int}) = d.apply() } + +class B extends Function0[Int] { + def apply() = 3 +} + +object Test +{ + type StructF0 = { def apply(): Int } + def main(args: Array[String]) { + for(i <- 0 until 150) + println(i + " " + test(A.apply) + " " + test(A2.apply) + " " + test(A3.apply) + " " + test(A3.apply)) + } + + def test(withF0: StructF0 => Int): Int = { + // Some large jar + val ivyJar = File("/local/lib/java/ivy.jar").toURL + // load a class in a separate loader that will be passed to A + val loader = new java.net.URLClassLoader(Array(File(".").toURL, ivyJar)) + // load a real class to fill perm gen space + Class.forName("org.apache.ivy.Ivy", true, loader).newInstance + // create a class from another class loader with an apply: Int method + val b = Class.forName("B", true, loader).newInstance + + // pass instance to a, which will call apply using structural type reflection. + // This should hold on to the class for B, which means bLoader will not get collected + withF0(b.asInstanceOf[StructF0]) + } +} diff --git a/test/pending/run/bug2365/bug2365.javaopts b/test/pending/run/bug2365/bug2365.javaopts new file mode 100644 index 0000000000..357e033c1c --- /dev/null +++ b/test/pending/run/bug2365/bug2365.javaopts @@ -0,0 +1 @@ +-XX:MaxPermSize=25M diff --git a/test/pending/run/bug2365/run b/test/pending/run/bug2365/run new file mode 100755 index 0000000000..f3c44ad086 --- /dev/null +++ b/test/pending/run/bug2365/run @@ -0,0 +1,13 @@ +#!/bin/sh +# +# This script should fail with any build of scala where #2365 +# is not fixed, and otherwise succeed. Failure means running out +# of PermGen space. + +CP=.:/local/lib/java/ivy.jar +# SCALAC=/scala/inst/28/bin/scalac +SCALAC=scalac +RUN_OPTS="-XX:MaxPermSize=25M -verbose:gc" + +$SCALAC -cp $CP *.scala +JAVA_OPTS="${RUN_OPTS}" scala -cp $CP Test |