From dbfdf0ec6d3ef0017b279dd9a195ce2615f9c3bb Mon Sep 17 00:00:00 2001 From: michelou Date: Tue, 10 Jun 2008 09:25:57 +0000 Subject: added EOLs, missing headers --- src/dotnet-library/scala/xml/Atom.scala | 2 +- src/dotnet-library/scala/xml/Comment.scala | 2 +- src/dotnet-library/scala/xml/Document.scala | 2 +- src/dotnet-library/scala/xml/Elem.scala | 2 +- src/dotnet-library/scala/xml/EntityRef.scala | 2 +- src/dotnet-library/scala/xml/Group.scala | 2 +- src/dotnet-library/scala/xml/HasKeyValue.scala | 2 +- .../scala/xml/MalformedAttributeException.scala | 2 +- src/dotnet-library/scala/xml/MetaData.scala | 2 +- .../scala/xml/NamespaceBinding.scala | 2 +- src/dotnet-library/scala/xml/Node.scala | 2 +- src/dotnet-library/scala/xml/NodeBuffer.scala | 2 +- src/dotnet-library/scala/xml/NodeSeq.scala | 2 +- src/dotnet-library/scala/xml/NodeTraverser.scala | 2 +- src/dotnet-library/scala/xml/Null.scala | 2 +- src/dotnet-library/scala/xml/PCData.scala | 2 +- src/dotnet-library/scala/xml/Parsing.scala | 2 +- .../scala/xml/PrefixedAttribute.scala | 2 +- src/dotnet-library/scala/xml/PrettyPrinter.scala | 2 +- src/dotnet-library/scala/xml/ProcInstr.scala | 2 +- src/dotnet-library/scala/xml/QNode.scala | 2 +- src/dotnet-library/scala/xml/SpecialNode.scala | 2 +- src/dotnet-library/scala/xml/Text.scala | 2 +- src/dotnet-library/scala/xml/TextBuffer.scala | 2 +- src/dotnet-library/scala/xml/TopScope.scala | 2 +- src/dotnet-library/scala/xml/TypeSymbol.scala | 2 +- src/dotnet-library/scala/xml/Unparsed.scala | 2 +- .../scala/xml/UnprefixedAttribute.scala | 2 +- src/dotnet-library/scala/xml/Utility.scala | 2 +- src/dotnet-library/scala/xml/XML.scala | 2 +- src/dotnet-library/scala/xml/Xhtml.scala | 2 +- .../scala/collection/RollbackIterator.scala | 44 +++++++++++++++------- src/library/scala/collection/Sorted.scala | 28 ++++++++------ src/library/scala/mobile/Code.scala | 11 +++--- test/files/pos/bug704.scala | 2 +- test/files/run/amp.scala | 8 +--- test/files/run/bugs.scala | 43 +++++++++++---------- test/files/run/unapply.scala | 4 +- 38 files changed, 110 insertions(+), 92 deletions(-) diff --git a/src/dotnet-library/scala/xml/Atom.scala b/src/dotnet-library/scala/xml/Atom.scala index ff3dd2bf72..cb97d64471 100644 --- a/src/dotnet-library/scala/xml/Atom.scala +++ b/src/dotnet-library/scala/xml/Atom.scala @@ -1 +1 @@ -/* Atom.scala does not exist for the dotnet target */ \ No newline at end of file +/* Atom.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Comment.scala b/src/dotnet-library/scala/xml/Comment.scala index f154d7e399..3fe49c7bf0 100644 --- a/src/dotnet-library/scala/xml/Comment.scala +++ b/src/dotnet-library/scala/xml/Comment.scala @@ -1 +1 @@ -/* Comment.scala does not exist for the dotnet target */ \ No newline at end of file +/* Comment.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Document.scala b/src/dotnet-library/scala/xml/Document.scala index 0e2a693d6f..9a3e44190b 100644 --- a/src/dotnet-library/scala/xml/Document.scala +++ b/src/dotnet-library/scala/xml/Document.scala @@ -1 +1 @@ -/* Document.scala does not exist for the dotnet target */ \ No newline at end of file +/* Document.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Elem.scala b/src/dotnet-library/scala/xml/Elem.scala index 9701daf434..6f51090eb4 100644 --- a/src/dotnet-library/scala/xml/Elem.scala +++ b/src/dotnet-library/scala/xml/Elem.scala @@ -1 +1 @@ -/* Elem.scala does not exist for the dotnet target */ \ No newline at end of file +/* Elem.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/EntityRef.scala b/src/dotnet-library/scala/xml/EntityRef.scala index b3c6091d6d..e179fb9ff8 100644 --- a/src/dotnet-library/scala/xml/EntityRef.scala +++ b/src/dotnet-library/scala/xml/EntityRef.scala @@ -1 +1 @@ -/* EntityRef.scala does not exist for the dotnet target */ \ No newline at end of file +/* EntityRef.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Group.scala b/src/dotnet-library/scala/xml/Group.scala index 1942178f7e..3a713746c0 100644 --- a/src/dotnet-library/scala/xml/Group.scala +++ b/src/dotnet-library/scala/xml/Group.scala @@ -1 +1 @@ -/* Group.scala does not exist for the dotnet target */ \ No newline at end of file +/* Group.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/HasKeyValue.scala b/src/dotnet-library/scala/xml/HasKeyValue.scala index 5b55cc68b6..31b53bfb7b 100644 --- a/src/dotnet-library/scala/xml/HasKeyValue.scala +++ b/src/dotnet-library/scala/xml/HasKeyValue.scala @@ -1 +1 @@ -/* HasKeyValue.scala does not exist for the dotnet target */ \ No newline at end of file +/* HasKeyValue.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/MalformedAttributeException.scala b/src/dotnet-library/scala/xml/MalformedAttributeException.scala index a32d2c8c58..4fea0996da 100644 --- a/src/dotnet-library/scala/xml/MalformedAttributeException.scala +++ b/src/dotnet-library/scala/xml/MalformedAttributeException.scala @@ -1 +1 @@ -/* MalformedAttributeException.scala does not exist for the dotnet target */ \ No newline at end of file +/* MalformedAttributeException.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/MetaData.scala b/src/dotnet-library/scala/xml/MetaData.scala index cc022353ef..16ba9b09d5 100644 --- a/src/dotnet-library/scala/xml/MetaData.scala +++ b/src/dotnet-library/scala/xml/MetaData.scala @@ -1 +1 @@ -/* MetaData.scala does not exist for the dotnet target */ \ No newline at end of file +/* MetaData.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/NamespaceBinding.scala b/src/dotnet-library/scala/xml/NamespaceBinding.scala index f57d44792d..6fa1309a7a 100644 --- a/src/dotnet-library/scala/xml/NamespaceBinding.scala +++ b/src/dotnet-library/scala/xml/NamespaceBinding.scala @@ -1 +1 @@ -/* NamespaceBinding.scala does not exist for the dotnet target */ \ No newline at end of file +/* NamespaceBinding.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Node.scala b/src/dotnet-library/scala/xml/Node.scala index ae4bd61d89..a4fda43174 100644 --- a/src/dotnet-library/scala/xml/Node.scala +++ b/src/dotnet-library/scala/xml/Node.scala @@ -1 +1 @@ -/* Node.scala does not exist for the dotnet target */ \ No newline at end of file +/* Node.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/NodeBuffer.scala b/src/dotnet-library/scala/xml/NodeBuffer.scala index 1f07f09ed4..37bed04b01 100644 --- a/src/dotnet-library/scala/xml/NodeBuffer.scala +++ b/src/dotnet-library/scala/xml/NodeBuffer.scala @@ -1 +1 @@ -/* NodeBuffer.scala does not exist for the dotnet target */ \ No newline at end of file +/* NodeBuffer.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/NodeSeq.scala b/src/dotnet-library/scala/xml/NodeSeq.scala index c49e0fa6fc..b7a6371a1c 100644 --- a/src/dotnet-library/scala/xml/NodeSeq.scala +++ b/src/dotnet-library/scala/xml/NodeSeq.scala @@ -1 +1 @@ -/* NodeSeq.scala does not exist for the dotnet target */ \ No newline at end of file +/* NodeSeq.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/NodeTraverser.scala b/src/dotnet-library/scala/xml/NodeTraverser.scala index e336444e8a..87aca3a120 100644 --- a/src/dotnet-library/scala/xml/NodeTraverser.scala +++ b/src/dotnet-library/scala/xml/NodeTraverser.scala @@ -1 +1 @@ -/* NodeTraverser.scala does not exist for the dotnet target */ \ No newline at end of file +/* NodeTraverser.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Null.scala b/src/dotnet-library/scala/xml/Null.scala index 0b1b2284cb..42f17eeade 100644 --- a/src/dotnet-library/scala/xml/Null.scala +++ b/src/dotnet-library/scala/xml/Null.scala @@ -1 +1 @@ -/* Null.scala does not exist for the dotnet target */ \ No newline at end of file +/* Null.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/PCData.scala b/src/dotnet-library/scala/xml/PCData.scala index 76c12030b3..185b016abc 100644 --- a/src/dotnet-library/scala/xml/PCData.scala +++ b/src/dotnet-library/scala/xml/PCData.scala @@ -1 +1 @@ -/* PCData.scala does not exist for the dotnet target */ \ No newline at end of file +/* PCData.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Parsing.scala b/src/dotnet-library/scala/xml/Parsing.scala index 5190e4d70d..510a535888 100644 --- a/src/dotnet-library/scala/xml/Parsing.scala +++ b/src/dotnet-library/scala/xml/Parsing.scala @@ -1 +1 @@ -/* Parsing.scala does not exist for the dotnet target */ \ No newline at end of file +/* Parsing.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/PrefixedAttribute.scala b/src/dotnet-library/scala/xml/PrefixedAttribute.scala index e307499554..a01eee7645 100644 --- a/src/dotnet-library/scala/xml/PrefixedAttribute.scala +++ b/src/dotnet-library/scala/xml/PrefixedAttribute.scala @@ -1 +1 @@ -/* PrefixedAttribute.scala does not exist for the dotnet target */ \ No newline at end of file +/* PrefixedAttribute.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/PrettyPrinter.scala b/src/dotnet-library/scala/xml/PrettyPrinter.scala index 10220e826c..c45630bbd8 100644 --- a/src/dotnet-library/scala/xml/PrettyPrinter.scala +++ b/src/dotnet-library/scala/xml/PrettyPrinter.scala @@ -1 +1 @@ -/* PrettyPrinter.scala does not exist for the dotnet target */ \ No newline at end of file +/* PrettyPrinter.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/ProcInstr.scala b/src/dotnet-library/scala/xml/ProcInstr.scala index 750265be9b..c3f6874fdf 100644 --- a/src/dotnet-library/scala/xml/ProcInstr.scala +++ b/src/dotnet-library/scala/xml/ProcInstr.scala @@ -1 +1 @@ -/* ProcInstr.scala does not exist for the dotnet target */ \ No newline at end of file +/* ProcInstr.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/QNode.scala b/src/dotnet-library/scala/xml/QNode.scala index 9b8089d068..29f02749fd 100644 --- a/src/dotnet-library/scala/xml/QNode.scala +++ b/src/dotnet-library/scala/xml/QNode.scala @@ -1 +1 @@ -/* QNode.scala does not exist for the dotnet target */ \ No newline at end of file +/* QNode.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/SpecialNode.scala b/src/dotnet-library/scala/xml/SpecialNode.scala index 909d567da0..857a02fd0e 100644 --- a/src/dotnet-library/scala/xml/SpecialNode.scala +++ b/src/dotnet-library/scala/xml/SpecialNode.scala @@ -1 +1 @@ -/* SpecialNode.scala does not exist for the dotnet target */ \ No newline at end of file +/* SpecialNode.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Text.scala b/src/dotnet-library/scala/xml/Text.scala index 3c87f56741..9b23f64781 100644 --- a/src/dotnet-library/scala/xml/Text.scala +++ b/src/dotnet-library/scala/xml/Text.scala @@ -1 +1 @@ -/* Text.scala does not exist for the dotnet target */ \ No newline at end of file +/* Text.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/TextBuffer.scala b/src/dotnet-library/scala/xml/TextBuffer.scala index b382b40807..3a97bc1f6d 100644 --- a/src/dotnet-library/scala/xml/TextBuffer.scala +++ b/src/dotnet-library/scala/xml/TextBuffer.scala @@ -1 +1 @@ -/* TextBuffer.scala does not exist for the dotnet target */ \ No newline at end of file +/* TextBuffer.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/TopScope.scala b/src/dotnet-library/scala/xml/TopScope.scala index f8256e76a0..bcc4491eba 100644 --- a/src/dotnet-library/scala/xml/TopScope.scala +++ b/src/dotnet-library/scala/xml/TopScope.scala @@ -1 +1 @@ -/* TopScope.scala does not exist for the dotnet target */ \ No newline at end of file +/* TopScope.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/TypeSymbol.scala b/src/dotnet-library/scala/xml/TypeSymbol.scala index 0a6c9469f8..d300f74b92 100644 --- a/src/dotnet-library/scala/xml/TypeSymbol.scala +++ b/src/dotnet-library/scala/xml/TypeSymbol.scala @@ -1 +1 @@ -/* TypeSymbol.scala does not exist for the dotnet target */ \ No newline at end of file +/* TypeSymbol.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Unparsed.scala b/src/dotnet-library/scala/xml/Unparsed.scala index f3d67e0d5c..2a0d68b690 100644 --- a/src/dotnet-library/scala/xml/Unparsed.scala +++ b/src/dotnet-library/scala/xml/Unparsed.scala @@ -1 +1 @@ -/* Unparsed.scala does not exist for the dotnet target */ \ No newline at end of file +/* Unparsed.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/UnprefixedAttribute.scala b/src/dotnet-library/scala/xml/UnprefixedAttribute.scala index c8825c6221..bb959f7c5b 100644 --- a/src/dotnet-library/scala/xml/UnprefixedAttribute.scala +++ b/src/dotnet-library/scala/xml/UnprefixedAttribute.scala @@ -1 +1 @@ -/* UnprefixedAttribute.scala does not exist for the dotnet target */ \ No newline at end of file +/* UnprefixedAttribute.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Utility.scala b/src/dotnet-library/scala/xml/Utility.scala index a85d08092f..874a96b58b 100644 --- a/src/dotnet-library/scala/xml/Utility.scala +++ b/src/dotnet-library/scala/xml/Utility.scala @@ -1 +1 @@ -/* Utility.scala does not exist for the dotnet target */ \ No newline at end of file +/* Utility.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/XML.scala b/src/dotnet-library/scala/xml/XML.scala index 9a56be7384..4333bf101b 100644 --- a/src/dotnet-library/scala/xml/XML.scala +++ b/src/dotnet-library/scala/xml/XML.scala @@ -1 +1 @@ -/* XML.scala does not exist for the dotnet target */ \ No newline at end of file +/* XML.scala does not exist for the dotnet target */ diff --git a/src/dotnet-library/scala/xml/Xhtml.scala b/src/dotnet-library/scala/xml/Xhtml.scala index 7e3a2cc360..d55d9b4f8b 100644 --- a/src/dotnet-library/scala/xml/Xhtml.scala +++ b/src/dotnet-library/scala/xml/Xhtml.scala @@ -1 +1 @@ -/* Xhtml.scala does not exist for the dotnet target */ \ No newline at end of file +/* Xhtml.scala does not exist for the dotnet target */ diff --git a/src/library/scala/collection/RollbackIterator.scala b/src/library/scala/collection/RollbackIterator.scala index 291d72f507..81567aca03 100644 --- a/src/library/scala/collection/RollbackIterator.scala +++ b/src/library/scala/collection/RollbackIterator.scala @@ -1,28 +1,43 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2007-2008, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + package scala.collection + import scala.collection.mutable.{ArrayBuffer} /** Rollback iterators are buffered iterators which allow for unbounded rollbacks * * @author Sean McDirmid */ -class RollbackIterator[+A](underlying : Iterator[A]) extends BufferedIterator.Default[A] { - private[this] var rollback : ArrayBuffer[A] = null - protected def fill(sz : Int) : Seq[A] = if (underlying.hasNext) underlying.next :: Nil else Nil +class RollbackIterator[+A](underlying: Iterator[A]) extends BufferedIterator.Default[A] { + private[this] var rollback: ArrayBuffer[A] = null + protected def fill(sz: Int): Seq[A] = + if (underlying.hasNext) underlying.next :: Nil else Nil - override def next : A = { + override def next: A = { val ret = super.next if (rollback != null) rollback += ret ret } - private def initRollback = if (rollback == null) { - rollback = new ArrayBuffer[A] - None - } else Some(rollback.length) + + private def initRollback = + if (rollback == null) { + rollback = new ArrayBuffer[A] + None + } + else Some(rollback.length) /** will rollback all elements iterated during * f's execution if f return false */ - def tryRead[T](f : => Option[T]) : Option[T] = { + def tryRead[T](f: => Option[T]): Option[T] = { val oldLength = initRollback var g : Option[T] = None try { @@ -45,9 +60,9 @@ class RollbackIterator[+A](underlying : Iterator[A]) extends BufferedIterator.De /** remembers elements iterated over during g's execution * and provides these elements to the result of g's execution */ - def remember[T](g : => (Seq[A] => T)) : T = { + def remember[T](g: => (Seq[A] => T)): T = { val oldLength = initRollback - var in : Seq[A] = Nil + var in: Seq[A] = Nil val f = try { g } finally { @@ -56,14 +71,17 @@ class RollbackIterator[+A](underlying : Iterator[A]) extends BufferedIterator.De } f(in) } + /** returns true if any elements are iterated over during f's execution */ - def read(f : => Unit) : Boolean = remember[Boolean]{ + def read(f: => Unit): Boolean = remember[Boolean] { f; seq => !seq.isEmpty } + /** if elements of seq will be iterated over next in this iterator, * returns true and iterates over these elements */ override def readIfStartsWith(seq : Seq[Any]) : Boolean = !tryRead{if (seq.forall(a => hasNext && next == a)) Some(()) else None}.isEmpty -} \ No newline at end of file + +} diff --git a/src/library/scala/collection/Sorted.scala b/src/library/scala/collection/Sorted.scala index eda7c21aef..b7ce28d8dd 100644 --- a/src/library/scala/collection/Sorted.scala +++ b/src/library/scala/collection/Sorted.scala @@ -1,22 +1,23 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2006-2007, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2006-2008, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ // $Id$ -package scala.collection; +package scala.collection /** Any collection (including maps) whose keys (or elements) are ordered. * * @author Sean McDirmid */ trait Sorted[K,+A] extends Ranged[K,A] { + /** return as a projection the set of keys in this collection */ - def keySet : SortedSet[K]; + def keySet: SortedSet[K] /** Creates a ranged projection of this collection. Any mutations in the * ranged projection will update this collection and vice versa. Keys @@ -27,15 +28,18 @@ trait Sorted[K,+A] extends Ranged[K,A] { * @param until The upper-bound (exclusive) of the ranged projection. * None if there is no upper bound. */ - override def rangeImpl(from: Option[K], until: Option[K]) : Sorted[K,A]; - override def from(from: K) = rangeImpl(Some(from), None); - override def until(until: K) = rangeImpl(None, Some(until)); - override def range(from: K, until: K) = rangeImpl(Some(from),Some(until)); + override def rangeImpl(from: Option[K], until: Option[K]): Sorted[K,A] + + override def from(from: K) = rangeImpl(Some(from), None) + + override def until(until: K) = rangeImpl(None, Some(until)) + + override def range(from: K, until: K) = rangeImpl(Some(from),Some(until)) /** Create a range projection of this collection with no lower-bound. * @param to The upper-bound (inclusive) of the ranged projection. */ - def to(to : K): Sorted[K,A] = { + def to(to: K): Sorted[K,A] = { // tough! val i = keySet.from(to).elements; if (!i.hasNext) return this; @@ -45,7 +49,8 @@ trait Sorted[K,+A] extends Ranged[K,A] { else return until(i.next); } else return until(next); } - protected def hasAll(j : Iterator[K]) : Boolean = { + + protected def hasAll(j: Iterator[K]): Boolean = { val i = keySet.elements; if (!i.hasNext) return !j.hasNext; var in = i.next; @@ -59,6 +64,7 @@ trait Sorted[K,+A] extends Ranged[K,A] { else true; }) in = i.next; } - return true; + true } + } diff --git a/src/library/scala/mobile/Code.scala b/src/library/scala/mobile/Code.scala index ba7a5b8fb4..0ff0092b23 100644 --- a/src/library/scala/mobile/Code.scala +++ b/src/library/scala/mobile/Code.scala @@ -195,7 +195,7 @@ class Code(clazz: java.lang.Class[_]) { private def applyFun(methName: String, args: Array[JObject], argTypes: Array[Class[T] forSome { type T }]): JObject = { try { - val method = clazz.getMethod(methName, argTypes: _*) + val method = clazz.getMethod(methName, argTypes) var obj: JObject = null if (! Modifier.isStatic(method.getModifiers())) { if (instance eq null) { @@ -205,7 +205,7 @@ class Code(clazz: java.lang.Class[_]) { val cs = clazz.getConstructors() //Console.println("cs.length=" + cs.length); if (cs.length > 0) { - cs(0).newInstance(Array(""): _*).asInstanceOf[AnyRef] + cs(0).newInstance(Array("")).asInstanceOf[AnyRef] } else { error("class " + clazz.getName() + " has no public constructor") null @@ -214,15 +214,15 @@ class Code(clazz: java.lang.Class[_]) { } obj = instance } - val result = method.invoke(obj, args: _*) + val result = method.invoke(obj, args) if (result eq null) ().asInstanceOf[JObject] else result } catch { case me: NoSuchMethodException => if (isConstructorName(methName)) { try { - val cstr = clazz.getConstructor(argTypes: _*) - instance = cstr.newInstance(args: _*).asInstanceOf[AnyRef] + val cstr = clazz.getConstructor(argTypes) + instance = cstr.newInstance(args).asInstanceOf[AnyRef] instance } catch { @@ -244,4 +244,3 @@ class Code(clazz: java.lang.Class[_]) { } } - diff --git a/test/files/pos/bug704.scala b/test/files/pos/bug704.scala index a05e0a51e7..e77a54a58e 100644 --- a/test/files/pos/bug704.scala +++ b/test/files/pos/bug704.scala @@ -5,7 +5,7 @@ trait D { } trait E extends D { - def f(): unit = { + def f(): Unit = { val y = "yyyy should appear twice" object yyyy { val x1 = get_xxxx diff --git a/test/files/run/amp.scala b/test/files/run/amp.scala index d46461ba20..367f3b31e4 100644 --- a/test/files/run/amp.scala +++ b/test/files/run/amp.scala @@ -1,19 +1,15 @@ object Test extends Application { def foo() = { - def f: int = 1 + def f: Int = 1 val x = f _ x } - def bar(g: => int) = { + def bar(g: => Int) = { g _ } Console.println((bar{ Console.println("g called"); 42 })()) Console.println(foo()()) - } - - - diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index 9339c1867f..2d0ad74628 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -272,7 +272,7 @@ object Bug226Test { def id[a](xs: Array[a]): Array[a] = xs; - def test(args: Array[String]): Unit = { + def test(args: Array[String]) { var xs = new Array[Int](1); class X { xs }; xs = id(xs); @@ -295,7 +295,7 @@ object Bug233Test { // Bug 250 object Bug250Test { - def test(args: Array[String]): Unit = { + def test(args: Array[String]) { if (true) null; () } @@ -316,7 +316,7 @@ object Bug257Test { f2(x); } - def test(args: Array[String]): Unit = { + def test(args: Array[String]) { f(sayhello())(sayhi()) } } @@ -333,16 +333,16 @@ abstract class Bug266AFoo { object Bug266ATest extends Bug266AFoo { type T = String; - class I1 extends I0 { def f(x: String): Unit = { Console.println("hello"); ();} } + class I1 extends I0 { def f(x: String) { Console.println("hello") } } def test(args: Array[String]): Unit = { new I1; () } } // version - B abstract class Bug266BA { - type t; + type t abstract class P { - def f(x: t): unit; + def f(x: t): Unit } } @@ -352,9 +352,9 @@ abstract class Bug266BA1 extends Bug266BA { } trait Bug266BB extends Bug266BA { - type t = int; + type t = Int; class P1 extends Bug266BB.this.P { - def f(x: int): unit = Console.println(x + 1); + def f(x: Int) { Console.println(x + 1) } } def mkP = new P1; val in = 3; @@ -368,7 +368,7 @@ object Bug266BTest { // main object Bug266Test { - def test(args: Array[String]): Unit = { + def test(args: Array[String]) { Bug266ATest.test(args); Bug266BTest.test(args); } @@ -378,8 +378,8 @@ object Bug266Test { // Bug 316 class Bug316MyIterator extends Iterator[Int] { - def hasNext = false; - def next = 42; + def hasNext = false + def next = 42 } object Bug316Test { @@ -391,7 +391,7 @@ object Bug316Test { // Bug 328 object Bug328Test { - def test0(f: Function1[Int,String]): Unit = (); + def test0(f: Function1[Int,String]) {} def test(args: Array[String]): Unit = test0(args); } @@ -430,7 +430,7 @@ object Bug399Test { (new G).f } - def test(args: Array[String]): Unit = { + def test(args: Array[String]) { Console.println(f("a")); } } @@ -439,24 +439,23 @@ object Bug399Test { // Main object Test { - var errors: Int = 0; - def test(bug: Int, test: => Unit): Unit = { - Console.println("<<< bug " + bug); + var errors: Int = 0 + def test(bug: Int, test: => Unit) { + Console.println("<<< bug " + bug) try { test; } catch { - case exception => { + case exception => val curr: String = currentThread.toString(); Console.print("Exception in thread \"" + curr + "\" " + exception); Console.println; - errors = errors + 1; - } + errors += 1 } - Console.println(">>> bug " + bug); - Console.println; + Console.println(">>> bug " + bug) + Console.println } - def main(args: Array[String]): Unit = { + def main(args: Array[String]) { test( 98, Bug98Test.test(args)); test(120, Bug120Test.test(args)); diff --git a/test/files/run/unapply.scala b/test/files/run/unapply.scala index b4efbda9fa..3325d034d3 100644 --- a/test/files/run/unapply.scala +++ b/test/files/run/unapply.scala @@ -17,7 +17,7 @@ class Bar { // test basic unapply for 0, 1 and 2 args and with precise type test object Fii { - def unapply(x: Any): boolean = x.isInstanceOf[Bar] + def unapply(x: Any): Boolean = x.isInstanceOf[Bar] } object Faa { def unapply(x: Any): Option[String] = if(x.isInstanceOf[Bar]) Some(x.asInstanceOf[Bar].name) else None @@ -105,7 +105,7 @@ object LisSeqArr extends TestCase("LisSeqArr") with Assert { object StreamFoo extends TestCase("unapply for Streams") with Assert { //val x:Stream[Int] = Stream.cons(1,x) - def sum(stream: Stream[int]): int = + def sum(stream: Stream[Int]): Int = stream match { case Stream.empty => 0 case Stream.cons(hd, tl) => hd + sum(tl) -- cgit v1.2.3