diff options
Diffstat (limited to 'test/files/run')
402 files changed, 1666 insertions, 1847 deletions
diff --git a/test/files/run/Course-2002-02.scala b/test/files/run/Course-2002-02.scala index 56d7298aaf..b8650108ed 100644 --- a/test/files/run/Course-2002-02.scala +++ b/test/files/run/Course-2002-02.scala @@ -100,7 +100,7 @@ object M4 { def sumInts = sum(x => x) def sumCubes = sum(x => x * x * x) - def sumReciprocals = sum(1.0/_) + def sumReciprocals = sum(1.0/_) def sumPi = { n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n) } Console.println(sumInts(1,4)) @@ -194,7 +194,7 @@ object M8 { //############################################################################ object M9 { - def accumulate[t](combiner: (t, t) => t, nullValue: t, f: Int => t, + def accumulate[t](combiner: (t, t) => t, nullValue: t, f: Int => t, next: Int => Int)(a: Int, b: Int): t = if (a > b) nullValue else combiner(f(a), accumulate(combiner, nullValue, f, next)(next(a), b)) @@ -328,9 +328,9 @@ object MD { iter(a, zero) } - def plus (x:Double,y:Double) = x+y; + def plus (x:Double,y:Double) = x+y; val sum: (Int => Double) => (Int, Int) => Double = reduce(plus , 0); - def times(x:Double,y:Double) = x*y; + def times(x:Double,y:Double) = x*y; val product: (Int => Double) => (Int, Int) => Double = reduce(times, 1); def factorial(n: Int) = product(x => x)(1 , n) diff --git a/test/files/run/Course-2002-05.scala b/test/files/run/Course-2002-05.scala index 9457fae147..e6764b92c8 100644 --- a/test/files/run/Course-2002-05.scala +++ b/test/files/run/Course-2002-05.scala @@ -129,7 +129,7 @@ object M3 { else { def isSafe(column: Int, placement: Placement): Boolean = placement forall { - pos => (pos._2 != column && + pos => (pos._2 != column && abs(pos._2 - column) != row - pos._1) } diff --git a/test/files/run/OrderingTest.scala b/test/files/run/OrderingTest.scala index 53448fbbce..8af18aaba5 100644 --- a/test/files/run/OrderingTest.scala +++ b/test/files/run/OrderingTest.scala @@ -6,7 +6,7 @@ object Test extends App { assert((cmp == 0) == (cmp2 == 0)) assert((cmp > 0) == (cmp2 < 0)) assert((cmp < 0) == (cmp2 > 0)) - } + } def testAll[T](t1 : T, t2 : T)(implicit ord : Ordering[T]) = { assert(ord.compare(t1, t2) < 0) @@ -16,8 +16,8 @@ object Test extends App { } assert(Ordering[String].compare("australopithecus", "brontausaurus") < 0) - // assert(Ordering[Unit].compare((), ()) == 0) - + // assert(Ordering[Unit].compare((), ()) == 0) + testAll("bar", "foo"); testAll[Byte](0, 1); testAll(false, true) @@ -28,7 +28,7 @@ object Test extends App { testAll[Iterable[Int]](List(1, 2), List(2)); testAll((1, "bar"), (1, "foo")) testAll((1, "foo"), (2, "bar")) - + // sortBy val words = "The quick brown fox jumped over the lazy dog".split(' ') val result = words.sortBy(x => (x.length, x.head)) diff --git a/test/files/run/ReplacementMatching.scala b/test/files/run/ReplacementMatching.scala index faa46419dc..05040d98a3 100644 --- a/test/files/run/ReplacementMatching.scala +++ b/test/files/run/ReplacementMatching.scala @@ -7,12 +7,12 @@ import util.matching._ object Test { - + def main(args: Array[String]) { replacementMatching groupsMatching } - + def replacementMatching { val regex = """\$\{(.+?)\}""".r val replaced = regex.replaceAllIn("Replacing: ${main}. And another method: ${foo}.", @@ -21,7 +21,7 @@ object Test { identifier }) assert(replaced == "Replacing: main. And another method: foo.") - + val regex3 = """\$\{(.+?)\}""".r val replaced3 = regex3.replaceSomeIn("Replacing: ${main}. And another: ${foo}.", (m: util.matching.Regex.Match) => { val id = m.group(1) @@ -29,7 +29,7 @@ object Test { }) assert(replaced3 == "Replacing: main. And another: ${foo}.") } - + def groupsMatching { val Date = """(\d+)/(\d+)/(\d+)""".r for (Regex.Groups(a, b, c) <- Date findFirstMatchIn "1/1/2001 marks the start of the millenium. 31/12/2000 doesn't.") { @@ -43,5 +43,5 @@ object Test { assert(c == "2001" || c == "2000") } } - + } diff --git a/test/files/run/ReverseSeqView.scala b/test/files/run/ReverseSeqView.scala index 517f1cc24c..2004791bff 100644 --- a/test/files/run/ReverseSeqView.scala +++ b/test/files/run/ReverseSeqView.scala @@ -5,14 +5,14 @@ object Test extends App { - + val lstv = List(1, 2, 3).view val lstvr = lstv.reverse assert(lstvr.iterator.toList == List(3, 2, 1)) assert(lstvr.reverse == List(1, 2, 3)) assert(lstvr.reverseIterator.toList == List(1, 2, 3)) assert(lstvr.reverseMap(_ + 1) == List(2, 3, 4)) - + } diff --git a/test/files/run/UnrolledBuffer.scala b/test/files/run/UnrolledBuffer.scala index fe08e812ac..62a1f7d083 100644 --- a/test/files/run/UnrolledBuffer.scala +++ b/test/files/run/UnrolledBuffer.scala @@ -7,12 +7,12 @@ import collection.mutable.UnrolledBuffer object Test { - + def main(args: Array[String]) { val u1 = new UnrolledBuffer[Int] assert(u1.isEmpty) assert(u1.size == 0) - + u1 += 1 u1 += 2 u1 += 3 @@ -20,11 +20,11 @@ object Test { assert(u1.toList == List(1, 2, 3)) assert(u1.nonEmpty) assert(u1.size == 3) - + u1.clear assert(u1.isEmpty) assert(u1.size == 0) - + u1 += 1 u1 += 2 u1 += 3 @@ -33,56 +33,56 @@ object Test { assert(u1.size == 2) assert(u1 == UnrolledBuffer(1, 3)) assert(u1.toList == List(1, 3)) - + u1 concat UnrolledBuffer(5, 7, 9) assert(u1 == UnrolledBuffer(1, 3, 5, 7, 9)) - + val u2 = u1 map { x => (x - 1) / 2 } assert(u2 == UnrolledBuffer(0, 1, 2, 3, 4)) - + u1.clear u2.clear assert(u1.size == 0) assert(u2.size == 0) - + for (i <- 0 until 500) u1 += i for (i <- 500 until 1000) u2 += i assert(u1.size == 500) assert(u2.size == 500) assert(u1.iterator.toList == (0 until 500).toList) assert((for (elem <- u1) yield elem) sameElements (0 until 500)) - + u1 concat u2 assert(u1.size == 1000) assert(u2.size == 0) assertCorrect(u1) - + u1 concat UnrolledBuffer() assertCorrect(u1) - + val u3 = u1 map { x => x } var i = 0 for (elem <- u1) { assert(elem == u3(i)) i += 1 } - + u1.remove(999) assert(u1.size == 999) assertCorrect(u1) - + u1.remove(500) assert(u1.size == 998) assertCorrect(u1) - + u1.remove(5) assert(u1.size == 997) assertCorrect(u1) - + u1.remove(0) assert(u1.size == 996) assertCorrect(u1) - + u1.insert(0, 0) assert(u1.size == 997) assertCorrect(u1) @@ -90,15 +90,15 @@ object Test { u1.insert(5, 5) assert(u1.size == 998) assertCorrect(u1) - + u1.insert(500, 500) assert(u1.size == 999) assertCorrect(u1) - + u1.insert(999, 999) assert(u1.size == 1000) assertCorrect(u1) - + for (i <- -100 until 0) { i +=: u1 assertCorrect(u1) @@ -106,7 +106,7 @@ object Test { assert(u1.size == 1100) assertCorrect(u1) } - + def assertCorrect(u1: UnrolledBuffer[Int]) { val sz = u1.size val store = new Array[Int](sz) @@ -117,9 +117,9 @@ object Test { for (i <- 0 until sz) assert(u1(i) == (sz - i)) for (i <- 0 until sz) u1(i) = store(i) for (i <- 0 until sz) assert(store(i) == u1(i)) - + assert((u1 map { x => x }) == u1) assert(u1.iterator.toSeq.size == u1.size) } - + } diff --git a/test/files/run/WeakHashSetTest.scala b/test/files/run/WeakHashSetTest.scala index 3c8f380150..8072aa9b84 100644 --- a/test/files/run/WeakHashSetTest.scala +++ b/test/files/run/WeakHashSetTest.scala @@ -33,7 +33,7 @@ package scala.reflect.internal.util { def checkEmpty { val hs = new WeakHashSet[String]() assert(hs.size == 0) - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate } // make sure += works @@ -85,7 +85,7 @@ package scala.reflect.internal.util { val hs = new WeakHashSet[Collider]() val elements = (0 until size).toList map {x => Collider("a" + x)} elements foreach (hs += _) - // don't throw the following into a retained collection so gc + // don't throw the following into a retained collection so gc // can remove them for (i <- 0 until size) { hs += Collider("b" + i) @@ -150,9 +150,9 @@ package scala.reflect.internal.util { hs.clear() assert(hs.size == 0) elements foreach {i => assert(!(hs contains i))} - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate } - + // check that the iterator covers all the contents def checkIterator { val hs = new WeakHashSet[String]() @@ -161,14 +161,14 @@ package scala.reflect.internal.util { assert(elements.iterator.toList.sorted == elements.sorted) hs.diagnostics.fullyValidate } - + // check that the iterator covers all the contents even when there is a collision def checkIteratorCollisions { val hs = new WeakHashSet[Collider] val elements = (0 until 20).toList map {x => Collider("a" + x)} elements foreach (hs += _) - assert(elements.iterator.toList.sorted == elements.sorted) + assert(elements.iterator.toList.sorted == elements.sorted) hs.diagnostics.fullyValidate } } -} +} diff --git a/test/files/run/absoverride.scala b/test/files/run/absoverride.scala index 8c6de09d2a..a3c03df0d7 100644 --- a/test/files/run/absoverride.scala +++ b/test/files/run/absoverride.scala @@ -26,16 +26,16 @@ trait SyncIterator extends AbsIterator { } } trait LoggedIterator extends AbsIterator { - abstract override def next: T = { - val x = super.next; println("log: " + x); x + abstract override def next: T = { + val x = super.next; println("log: " + x); x } } -class Iter2(s: String) extends StringIterator(s) - with SyncIterator with LoggedIterator; +class Iter2(s: String) extends StringIterator(s) + with SyncIterator with LoggedIterator; object Test { def main(args: Array[String]) { class Iter extends StringIterator(args(0)) with RichIterator with SyncIterator with LoggedIterator val iter = new Iter - iter foreach Console.println + iter foreach Console.println } } diff --git a/test/files/run/annotatedRetyping.scala b/test/files/run/annotatedRetyping.scala index cf1b0f27b5..9b9ebd5a1e 100644 --- a/test/files/run/annotatedRetyping.scala +++ b/test/files/run/annotatedRetyping.scala @@ -40,7 +40,7 @@ object Test extends DirectTest { defTree match { case impl: Template => templates += typer.context.owner -> (impl, typer) - + case dd: DefDef if dd.symbol.isPrimaryConstructor && templates.contains(dd.symbol.owner) => val (impl, templTyper) = templates(dd.symbol.owner) for (stat <- impl.body.filterNot(_.isDef)) { @@ -50,7 +50,7 @@ object Test extends DirectTest { tpr.typed(stat) } - case _ => + case _ => } tpe } diff --git a/test/files/run/array-existential-bound.scala b/test/files/run/array-existential-bound.scala index b397c98111..cc105d8fcd 100644 --- a/test/files/run/array-existential-bound.scala +++ b/test/files/run/array-existential-bound.scala @@ -7,7 +7,7 @@ object Test extends Fooz[Array[Int]] { val f2 = new Fooz[Array[Int]] { } val f3 = new Fooz[Array[Any]] { } val f4 = new Fooz[Array[_]] { } - + def main(args: Array[String]): Unit = { println(f1.f0(Array[String]("a", "b"))) println(f2.f0((1 to 1000).toArray)) diff --git a/test/files/run/arrayclone-old.scala b/test/files/run/arrayclone-old.scala index c9f7556b47..fbca38b42e 100644 --- a/test/files/run/arrayclone-old.scala +++ b/test/files/run/arrayclone-old.scala @@ -16,7 +16,7 @@ object BooleanArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = false; - assert(it(0) == true) + assert(it(0) == true) } object ByteArrayClone{ @@ -24,7 +24,7 @@ object ByteArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object ShortArrayClone{ @@ -32,7 +32,7 @@ object ShortArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object CharArrayClone{ @@ -40,7 +40,7 @@ object CharArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object IntArrayClone{ @@ -48,7 +48,7 @@ object IntArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object LongArrayClone{ @@ -56,7 +56,7 @@ object LongArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object FloatArrayClone{ @@ -64,7 +64,7 @@ object FloatArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object DoubleArrayClone{ @@ -72,7 +72,7 @@ object DoubleArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object ObjectArrayClone{ @@ -80,7 +80,7 @@ object ObjectArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = "0"; - assert(it(0) == "1") + assert(it(0) == "1") } object PolymorphicArrayClone{ @@ -88,14 +88,14 @@ object PolymorphicArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = zero; - assert(it(0) == one) - } + 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 it = ts.toArray[T]; } val mangled = new Mangler[Int](0, 1); diff --git a/test/files/run/arraycopy.scala b/test/files/run/arraycopy.scala index 82c34c23e7..bb06200dc7 100644 --- a/test/files/run/arraycopy.scala +++ b/test/files/run/arraycopy.scala @@ -5,7 +5,7 @@ object Test { val a = new Array[Int](10) val b = new Array[Any](10) for (i <- 0 until 10) b(i) = i - + Array.copy(b, 3, a, 3, 7) assert(a.toSeq == List(0, 0, 0, 3, 4, 5, 6, 7, 8, 9)) } diff --git a/test/files/run/arrayview.scala b/test/files/run/arrayview.scala index 42ced5e9ac..97e840f5e9 100644 --- a/test/files/run/arrayview.scala +++ b/test/files/run/arrayview.scala @@ -1,6 +1,6 @@ object Test { def f = (1 to 100).toArray.view - + def main(args: Array[String]): Unit = { val xs = (f filter (_ < 50)).reverse.filter(_ % 2 == 0).map(_ / 2).flatMap(x => Array(1, x)) assert(xs.size == 48) diff --git a/test/files/run/bigDecimalCache.scala b/test/files/run/bigDecimalCache.scala index e8ebefee78..c0c709a50f 100644 --- a/test/files/run/bigDecimalCache.scala +++ b/test/files/run/bigDecimalCache.scala @@ -1,9 +1,9 @@ -object Test { +object Test { def main(args: Array[String]): Unit = { val bd5a = BigDecimal(5) val mc = java.math.MathContext.DECIMAL32 val bd5b = BigDecimal(5,mc) - + assert(bd5b.mc == mc) } } diff --git a/test/files/run/bigDecimalTest.scala b/test/files/run/bigDecimalTest.scala index 07b524c017..480305d7d4 100644 --- a/test/files/run/bigDecimalTest.scala +++ b/test/files/run/bigDecimalTest.scala @@ -28,7 +28,7 @@ object Test { // SI-4547: implicit conversion assert(5 + BigDecimal(3) == BigDecimal(8)) - + // meaningless sanity check List[BigDecimal](a, b, c, d, e, f) map (_.scale) foreach println } diff --git a/test/files/run/boolexprs.scala b/test/files/run/boolexprs.scala index 4f1c4b161a..b9b4faea9c 100644 --- a/test/files/run/boolexprs.scala +++ b/test/files/run/boolexprs.scala @@ -10,7 +10,7 @@ class Counter { object Test1 { var flag = false; - def flip: Boolean = { val tmp = flag; flag = !flag; tmp } + def flip: Boolean = { val tmp = flag; flag = !flag; tmp } def run: Int = { val c = new Counter; c.incrThen(flip || flip); diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index 9d2be42fb7..ba8449c299 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -304,7 +304,7 @@ object Bug250Test { // Bug 257 object Bug257Test { - def sayhello(): Unit = { Console.println("I should come 1st and 2nd"); }; + def sayhello(): Unit = { Console.println("I should come 1st and 2nd"); }; def sayhi(): Unit = { Console.println("I should come last"); }; def f1(x: Unit): Unit = (); diff --git a/test/files/run/caseClassEquality.scala b/test/files/run/caseClassEquality.scala index 4940d80951..c11d7ad0d1 100644 --- a/test/files/run/caseClassEquality.scala +++ b/test/files/run/caseClassEquality.scala @@ -11,25 +11,25 @@ object Test { case _ => false } } - + case class CS1(xs: Any*) class CS2(xs: Seq[_]*) extends CS1(xs: _*) class CS3(xs: IndexedSeq[Int]*) extends CS2(xs: _*) - + case class H1(x: Int, y: Double) class H2(x: Double, y: Int) extends H1(y, x) - + def main(args: Array[String]): Unit = { assert(C1(5) == new C2(5)) assert(new C2(5) == C1(5)) assert(C1(5).hashCode == new C2(5).hashCode) assert(new C2(5).hashCode == C1(5).hashCode) - + assert(C1(5) != new C3(5)) assert(new C3(5) != C1(5)) - + assert(CS1(List(1d,2d), Seq[Float](3f, 4f)) == new CS3(IndexedSeq(1,2), IndexedSeq(3, 4))) - + assert(H1(5, 10d) == new H2(10d, 5)) assert(H1(5, 10d).hashCode == new H2(10d, 5).hashCode) } diff --git a/test/files/run/castsingleton.scala b/test/files/run/castsingleton.scala index 47bd613079..339f5e00cf 100644 --- a/test/files/run/castsingleton.scala +++ b/test/files/run/castsingleton.scala @@ -8,4 +8,4 @@ object Test extends App { } empty(L()) -} +} diff --git a/test/files/run/checked.scala b/test/files/run/checked.scala index 06bc0c05e5..e4db9c0916 100644 --- a/test/files/run/checked.scala +++ b/test/files/run/checked.scala @@ -23,9 +23,9 @@ trait T { // Should not throw class D extends B with T { val sum = x + y + z + b1 + b2 + t1 + t2 - override def toString = + override def toString = "sum = " + sum - + } abstract class NeedsXEarly { @@ -91,7 +91,7 @@ class TestInterference extends { object Test extends App { - + def shouldThrow(t: => Unit) = try { t println("[FAIL]: No UFE thrown") diff --git a/test/files/run/classfile-format-51.scala b/test/files/run/classfile-format-51.scala index 378caa7936..f92382d89b 100644 --- a/test/files/run/classfile-format-51.scala +++ b/test/files/run/classfile-format-51.scala @@ -91,14 +91,14 @@ object Test extends DirectTest { val bytes = cw.toByteArray() val fos = new FileOutputStream(new File(s"${testOutput.path}/$invokerClassName.class")) - try + try fos write bytes finally fos.close() } - def code = + def code = """ object Driver { val invoker = new DynamicInvoker() @@ -112,14 +112,14 @@ object Driver { System.setErr(System.out) try { // this test is only valid under JDK 1.7+ - testUnderJavaAtLeast("1.7") { + testUnderJavaAtLeast("1.7") { generateClass() compile() () } otherwise { () } - } + } finally System.setErr(prevErr) } diff --git a/test/files/run/classfile-format-52.scala b/test/files/run/classfile-format-52.scala index 7afa09ae0b..e12c84124c 100644 --- a/test/files/run/classfile-format-52.scala +++ b/test/files/run/classfile-format-52.scala @@ -7,7 +7,7 @@ import asm.{AnnotationVisitor, ClassWriter, FieldVisitor, Handle, MethodVisitor, import Opcodes._ // This test ensures that we can read JDK 8 (classfile format 52) files, including those -// with default methods. To do that it first uses ASM to generate an interface called +// with default methods. To do that it first uses ASM to generate an interface called // HasDefaultMethod. Then it runs a normal compile on Scala source that extends that // interface. Any failure will be dumped to std out. // @@ -40,14 +40,14 @@ object Test extends DirectTest { val bytes = cw.toByteArray() val fos = new FileOutputStream(new File(s"${testOutput.path}/$interfaceName.class")) - try + try fos write bytes finally fos.close() } - def code = + def code = """ class Driver extends HasDefaultMethod { println(publicMethod()) @@ -65,12 +65,12 @@ class Driver extends HasDefaultMethod { generateInterface() compile() Class.forName("Driver").newInstance() - () + () } otherwise { println("hello from publicMethod") - println("hello from staticMethod") + println("hello from staticMethod") } - } + } finally System.setErr(prevErr) } diff --git a/test/files/run/classof.check b/test/files/run/classof.check index 0d650b87c0..83e292352d 100644 --- a/test/files/run/classof.check +++ b/test/files/run/classof.check @@ -17,6 +17,6 @@ class [Lscala.runtime.BoxedUnit; class [I class [D class [Lscala.collection.immutable.List; -Functions: +Functions: interface scala.Function2 interface scala.Function1 diff --git a/test/files/run/classof.scala b/test/files/run/classof.scala index 10c07d2e51..257829e976 100644 --- a/test/files/run/classof.scala +++ b/test/files/run/classof.scala @@ -13,19 +13,19 @@ object Test { println(classOf[Long]) println(classOf[Float]) println(classOf[Double]) - + println("Class types") println(classOf[SomeClass]) println(classOf[List[Array[Float]]]) println(classOf[(String, Map[Int, String])]) println("Arrays:") - println(classOf[Array[Unit]]) + println(classOf[Array[Unit]]) println(classOf[Array[Int]]) println(classOf[Array[Double]]) println(classOf[Array[List[String]]]) - println("Functions: ") + println("Functions:") println(classOf[(Int, Int) => Unit]) println(classOf[Int => Boolean]) } diff --git a/test/files/run/collection-conversions.scala b/test/files/run/collection-conversions.scala index d842742230..cd05f68e26 100644 --- a/test/files/run/collection-conversions.scala +++ b/test/files/run/collection-conversions.scala @@ -8,11 +8,11 @@ object Test { def printResult[A,B](msg: String, obj: A, expected: B)(implicit tag: ClassTag[A], tag2: ClassTag[B]) = { print(" :" + msg +": ") - val isArray = obj match { - case x: Array[Int] => true + val isArray = obj match { + case x: Array[Int] => true case _ => false } - val expectedEquals = + val expectedEquals = if(isArray) obj.asInstanceOf[Array[Int]].toSeq == expected.asInstanceOf[Array[Int]].toSeq else obj == expected val tagEquals = tag == tag2 @@ -49,7 +49,7 @@ object Test { printResult("[Copy] ParVector", col.to[ParVector], testParVector) printResult("[Copy] ParArray ", col.to[ParArray], testParArray) } - + def main(args: Array[String]): Unit = { testConversion("iterator", (1 to 3).iterator) testConversion("Vector", Vector(1,2,3)) diff --git a/test/files/run/collections-toSelf.scala b/test/files/run/collections-toSelf.scala index 2adbc22af7..02f1dd6a95 100644 --- a/test/files/run/collections-toSelf.scala +++ b/test/files/run/collections-toSelf.scala @@ -2,7 +2,7 @@ object Test { val map = Map(1 -> 2) val set = Set(1, 2) val seq = collection.immutable.Seq(1, 2) - + def main(args: Array[String]): Unit = { assert(map.toMap eq map) assert(set.toSet eq set) diff --git a/test/files/run/collections.scala b/test/files/run/collections.scala index 1e4e8791ac..2b19ff4e75 100644 --- a/test/files/run/collections.scala +++ b/test/files/run/collections.scala @@ -62,7 +62,7 @@ object Test extends App { } time { var x = 0 - for (i <- 0 to 10000) + for (i <- 0 to 10000) s get i match { case Some(i) => x += i case None => @@ -97,7 +97,7 @@ object Test extends App { } time { var x = 0 - for (i <- 0 to 10000) + for (i <- 0 to 10000) s get i match { case Some(i) => x += i case None => diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala index 9d77fc413a..8dce69afc9 100644 --- a/test/files/run/colltest1.scala +++ b/test/files/run/colltest1.scala @@ -65,7 +65,7 @@ object Test extends App { assert(ten.toStream == ten) assert(ten.toString endsWith "(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)") assert(ten.mkString("[", "; ", "]") endsWith "[1; 2; 3; 4; 5; 6; 7; 8; 9; 10]") - } + } def orderedIterableTest(empty: Iterable[Int]) { orderedTraversableTest(empty) @@ -88,7 +88,7 @@ object Test extends App { assert(ten(0) == 1 && ten(9) == 10) assert((ten lengthCompare 10) == 0 && (ten lengthCompare 1) > 0 && (ten lengthCompare 11) < 0) assert((ten isDefinedAt 0) && (ten isDefinedAt 9)) - assert(!(ten isDefinedAt -1)); + assert(!(ten isDefinedAt -1)); assert(!(ten isDefinedAt 10)) val tenten = ten zip ten assert((tenten map (_._1)) == ten) @@ -178,8 +178,8 @@ object Test extends App { m ++= ('J' to 'Z') map (x => (x.toString -> x.toString)) println(m.toList.sorted) assert(!m.isEmpty) - assert(m.keySet forall (k => (m get k) == Some(k))) - assert(m.keySet forall (k => (m apply k) == k)) + assert(m.keySet forall (k => (m get k) == Some(k))) + assert(m.keySet forall (k => (m apply k) == k)) assert(m.keySet forall (m contains)) assert(m.getOrElse("7", "@") == "@") assert(m.keySet.size == 26) diff --git a/test/files/run/comparable-comparator.scala b/test/files/run/comparable-comparator.scala index 1707fb6e61..f059cc52f3 100644 --- a/test/files/run/comparable-comparator.scala +++ b/test/files/run/comparable-comparator.scala @@ -1,7 +1,7 @@ object Test { import java.util.Comparator - + class C1(val s: String) extends Comparable[C1] { def compareTo(other: C1) = s compareTo other.s override def toString = s @@ -10,7 +10,7 @@ object Test { def compareTo(other: C2) = s compareTo other.s override def toString = s } - + implicit val cmp: Comparator[C2] = new Comparator[C2] { def compare(p1: C2, p2: C2) = p2.s compareTo p1.s } @@ -19,10 +19,10 @@ object Test { val strs = words.toList val c1s = strs map (x => new C1(x)) val c2s = strs map (x => new C2(x)) - + val sorted1 = c1s.sorted map (_.s) val sorted2 = c2s.sorted map (_.s) - + def main(args: Array[String]): Unit = { assert(sorted1 == sorted2.reverse) } diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala index bd3db0bf66..7020469bb2 100644 --- a/test/files/run/compiler-asSeenFrom.scala +++ b/test/files/run/compiler-asSeenFrom.scala @@ -51,10 +51,10 @@ package ll { for (p <- typeRefPrefixes ; c <- classes filter (isPossibleEnclosure(p.typeSymbol, _)) ; a <- targs) yield typeRef(p, c, List(a)) ) - + val wfmt = "%-" + 25 + "s" def to_s(x: Any): String = wfmt.format(x.toString.replaceAll("""\bll\.""", "")) - + def fmt(args: Any*): String = { (args map to_s mkString " ").replaceAll("""\s+$""", "") } @@ -65,7 +65,7 @@ package ll { } def permuteAsSeenFrom(targs: List[Type]) = ( - for { + for { tp <- typeRefs(targs filterNot (_ eq NoType)) prefix <- asSeenPrefixes if tp.prefix != prefix @@ -76,11 +76,11 @@ package ll { } yield ((site, tp, prefix, seen)) ) - + def block(label: Any)(lines: List[String]): List[String] = { val first = "" + label + " {" val last = "}" - + first +: lines.map(" " + _) :+ last } @@ -88,7 +88,7 @@ package ll { permuteAsSeenFrom(targs).groupBy(_._1).toList.sortBy(_._1.toString) flatMap { case (site, xs) => block(fmt(site)) { - fmt("type", "seen from prefix", "is") :: + fmt("type", "seen from prefix", "is") :: fmt("----", "----------------", "--") :: { xs.groupBy(_._2).toList.sortBy(_._1.toString) flatMap { case (tp, ys) => @@ -99,7 +99,7 @@ package ll { } } } - + def pretty(xs: List[_]) = if (xs.isEmpty) "" else xs.mkString("\n ", "\n ", "\n") def signaturesIn(info: Type): List[String] = ( @@ -107,7 +107,7 @@ package ll { filterNot (s => s.isType || s.owner == ObjectClass || s.owner == AnyClass || s.isConstructor) map (_.defString) ) - + def check(source: String, unit: global.CompilationUnit) = { import syms._ diff --git a/test/files/run/concat-two-strings.scala b/test/files/run/concat-two-strings.scala index ad796fe0ee..c8881aa146 100644 --- a/test/files/run/concat-two-strings.scala +++ b/test/files/run/concat-two-strings.scala @@ -8,7 +8,7 @@ object Test { def f4(x: List[Int]) = "" + x def f5(x: Any) = "" + x def f6(x: AnyVal) = "" + x - + def main(args: Array[String]): Unit = { List(f1("a"), f2(5), f3(null), f3(Array('a')), f4(List(1)), f5(null), f6(55d)) mkString "" } diff --git a/test/files/run/concurrent-map-conversions.scala b/test/files/run/concurrent-map-conversions.scala index 0350b69642..d23d5bbbe4 100644 --- a/test/files/run/concurrent-map-conversions.scala +++ b/test/files/run/concurrent-map-conversions.scala @@ -4,33 +4,33 @@ object Test { - + def main(args: Array[String]) { testConversions() testConverters() } - + def needPackageConcurrentMap(map: collection.concurrent.Map[Int, Int]) { } def needJavaConcurrent(map: java.util.concurrent.ConcurrentMap[Int, Int]) { } - + def testConversions() { import collection.JavaConversions._ val skiplist = new java.util.concurrent.ConcurrentSkipListMap[Int, Int] val ctrie = new collection.concurrent.TrieMap[Int, Int] - + needPackageConcurrentMap(skiplist) needJavaConcurrent(ctrie) } - + def testConverters() { import collection.JavaConverters._ val skiplist = new java.util.concurrent.ConcurrentSkipListMap[Int, Int] val ctrie = new collection.concurrent.TrieMap[Int, Int] - + needPackageConcurrentMap(skiplist.asScala) needJavaConcurrent(ctrie.asJava) } - + } diff --git a/test/files/run/constant-type.check b/test/files/run/constant-type.check index 4eededb8ba..77bdf618e6 100644 --- a/test/files/run/constant-type.check +++ b/test/files/run/constant-type.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** ** :phase has been set to 'typer'. ** @@ -26,5 +24,3 @@ scala> { ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(printl Class(classOf[java.lang.String]) scala> - -scala> diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index 8b53e2391d..f022aac1b2 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -1,10 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> - scala> class Annot(obj: Any) extends annotation.Annotation with annotation.TypeConstraint defined class Annot @@ -14,7 +10,7 @@ scala> class A { val x = "hello" val y: Int @Annot(x) = 10 override def toString = "an A" -} +} defined class A scala> @@ -22,7 +18,7 @@ scala> scala> val a = new A a: A = an A -scala> val y = a.y // should rewrite "this.x" to "a.x" +scala> val y = a.y // should rewrite "this.x" to "a.x" y: Int @Annot(a.x) = 10 scala> var a2 = new A @@ -154,5 +150,3 @@ scala> val x : Int @Where(self > 0 && self < 100) = 3 x: Int @Where(self.>(0).&&(self.<(100))) = 3 scala> - -scala> diff --git a/test/files/run/constrained-types.scala b/test/files/run/constrained-types.scala index 38ae076c06..91bd856d00 100644 --- a/test/files/run/constrained-types.scala +++ b/test/files/run/constrained-types.scala @@ -15,10 +15,10 @@ class A { val x = "hello" val y: Int @Annot(x) = 10 override def toString = "an A" -} +} val a = new A -val y = a.y // should rewrite "this.x" to "a.x" +val y = a.y // should rewrite "this.x" to "a.x" var a2 = new A val y2 = a2.y // should drop the annotation diff --git a/test/files/run/ctor-order.scala b/test/files/run/ctor-order.scala index a223ff77e8..5f5871691a 100644 --- a/test/files/run/ctor-order.scala +++ b/test/files/run/ctor-order.scala @@ -8,7 +8,7 @@ class Outer { class X extends { /* The constructor of X should set this.$outer to the outer instance - * *before* calling the super constructors. This is tested by + * *before* calling the super constructors. This is tested by * mixin M1, which tries to access global from the enclosing class. */ val outer = Outer.this diff --git a/test/files/run/ctries-new/concmap.scala b/test/files/run/ctries-new/concmap.scala index 3ec0256afb..76916564a7 100644 --- a/test/files/run/ctries-new/concmap.scala +++ b/test/files/run/ctries-new/concmap.scala @@ -5,17 +5,17 @@ import collection.concurrent.TrieMap object ConcurrentMapSpec extends Spec { - + val initsz = 500 val secondsz = 750 - + def test() { "support put" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) assert(ct.put(new Wrap(i), i) == None) for (i <- 0 until initsz) assert(ct.put(new Wrap(i), -i) == Some(i)) } - + "support put if absent" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -24,7 +24,7 @@ object ConcurrentMapSpec extends Spec { for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), -i) == None) for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), i) == Some(-i)) } - + "support remove if mapped to a specific value" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -32,7 +32,7 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == true) for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == false) } - + "support replace if mapped to a specific value" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -41,7 +41,7 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i, -i - 2) == false) for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i, 0) == false) } - + "support replace if present" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -49,17 +49,17 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i) == Some(-i)) for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i) == None) } - + def assertEqual(a: Any, b: Any) = { if (a != b) println(a, b) assert(a == b) } - + "support replace if mapped to a specific value, using several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 55000 for (i <- 0 until sz) ct.update(new Wrap(i), i) - + class Updater(index: Int, offs: Int) extends Thread { override def run() { var repeats = 0 @@ -74,24 +74,24 @@ object ConcurrentMapSpec extends Spec { //println("Thread %d repeats: %d".format(index, repeats)) } } - + val threads = for (i <- 0 until 16) yield new Updater(i, sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), i) - + val threads2 = for (i <- 0 until 15) yield new Updater(i, sz / 32 * i) threads2.foreach(_.start()) threads2.foreach(_.join()) - + for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), -i) } - + "support put if absent, several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 110000 - + class Updater(offs: Int) extends Thread { override def run() { for (i <- 0 until sz) { @@ -101,19 +101,19 @@ object ConcurrentMapSpec extends Spec { } } } - + val threads = for (i <- 0 until 16) yield new Updater(sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assert(ct(new Wrap(i)) == i) } - + "support remove if mapped to a specific value, several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 55000 for (i <- 0 until sz) ct.update(new Wrap(i), i) - + class Remover(offs: Int) extends Thread { override def run() { for (i <- 0 until sz) { @@ -123,19 +123,19 @@ object ConcurrentMapSpec extends Spec { } } } - + val threads = for (i <- 0 until 16) yield new Remover(sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assert(ct.get(new Wrap(i)) == None) } - + "have all or none of the elements depending on the oddity" in { val ct = new TrieMap[Wrap, Int] val sz = 65000 for (i <- 0 until sz) ct(new Wrap(i)) = i - + class Modifier(index: Int, offs: Int) extends Thread { override def run() { for (j <- 0 until sz) { @@ -151,38 +151,38 @@ object ConcurrentMapSpec extends Spec { } } } - + def modify(n: Int) = { val threads = for (i <- 0 until n) yield new Modifier(i, sz / n * i) threads.foreach(_.start()) threads.foreach(_.join()) } - + modify(16) for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), Some(i)) modify(15) for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), None) } - + "compute size correctly" in { val ct = new TrieMap[Wrap, Int] val sz = 36450 for (i <- 0 until sz) ct(new Wrap(i)) = i - + assertEqual(ct.size, sz) assertEqual(ct.size, sz) } - + "compute size correctly in parallel" in { val ct = new TrieMap[Wrap, Int] val sz = 36450 for (i <- 0 until sz) ct(new Wrap(i)) = i val pct = ct.par - + assertEqual(pct.size, sz) assertEqual(pct.size, sz) } - + } - + } diff --git a/test/files/run/ctries-new/lnode.scala b/test/files/run/ctries-new/lnode.scala index 92a31088e5..4cc97050e5 100644 --- a/test/files/run/ctries-new/lnode.scala +++ b/test/files/run/ctries-new/lnode.scala @@ -5,23 +5,23 @@ import collection.concurrent.TrieMap object LNodeSpec extends Spec { - + val initsz = 1500 val secondsz = 1750 - + def test() { "accept elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) } - + "lookup elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == Some(i)) for (i <- initsz until secondsz) assert(ct.get(new DumbHash(i)) == None) } - + "remove elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) @@ -31,7 +31,7 @@ object LNodeSpec extends Spec { } for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == None) } - + "put elements with the same hash codes if absent" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.put(new DumbHash(i), i) @@ -40,7 +40,7 @@ object LNodeSpec extends Spec { for (i <- initsz until secondsz) assert(ct.putIfAbsent(new DumbHash(i), i) == None) for (i <- initsz until secondsz) assert(ct.lookup(new DumbHash(i)) == i) } - + "replace elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None) @@ -49,13 +49,13 @@ object LNodeSpec extends Spec { for (i <- 0 until initsz) assert(ct.lookup(new DumbHash(i)) == -i) for (i <- 0 until initsz) assert(ct.replace(new DumbHash(i), -i, i) == true) } - + "remove elements with the same hash codes if mapped to a specific value" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None) for (i <- 0 until initsz) assert(ct.remove(new DumbHash(i), i) == true) } - + } - + } diff --git a/test/files/run/ctries-new/snapshot.scala b/test/files/run/ctries-new/snapshot.scala index 5fe77d445b..57155d49c6 100644 --- a/test/files/run/ctries-new/snapshot.scala +++ b/test/files/run/ctries-new/snapshot.scala @@ -8,22 +8,22 @@ import collection.concurrent.TrieMap object SnapshotSpec extends Spec { - + def test() { "support snapshots" in { val ctn = new TrieMap ctn.snapshot() ctn.readOnlySnapshot() - + val ct = new TrieMap[Int, Int] for (i <- 0 until 100) ct.put(i, i) ct.snapshot() ct.readOnlySnapshot() } - + "empty 2 quiescent snapshots in isolation" in { val sz = 4000 - + class Worker(trie: TrieMap[Wrap, Int]) extends Thread { override def run() { for (i <- 0 until sz) { @@ -34,46 +34,46 @@ object SnapshotSpec extends Spec { } } } - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.put(new Wrap(i), i) val snapt = ct.snapshot() - + val original = new Worker(ct) val snapshot = new Worker(snapt) original.start() snapshot.start() original.join() snapshot.join() - + for (i <- 0 until sz) { assert(ct.get(new Wrap(i)) == None) assert(snapt.get(new Wrap(i)) == None) } } - + def consistentReadOnly(name: String, readonly: Map[Wrap, Int], sz: Int, N: Int) { @volatile var e: Exception = null - + // reads possible entries once and stores them // then reads all these N more times to check if the // state stayed the same class Reader(trie: Map[Wrap, Int]) extends Thread { setName("Reader " + name) - + override def run() = try check() catch { case ex: Exception => e = ex } - + def check() { val initial = mutable.Map[Wrap, Int]() for (i <- 0 until sz) trie.get(new Wrap(i)) match { case Some(i) => initial.put(new Wrap(i), i) case None => // do nothing } - + for (k <- 0 until N) { for (i <- 0 until sz) { val tres = trie.get(new Wrap(i)) @@ -84,21 +84,21 @@ object SnapshotSpec extends Spec { } } } - + val reader = new Reader(readonly) reader.start() reader.join() - + if (e ne null) { e.printStackTrace() throw e } } - + // traverses the trie `rep` times and modifies each entry class Modifier(trie: TrieMap[Wrap, Int], index: Int, rep: Int, sz: Int) extends Thread { setName("Modifier %d".format(index)) - + override def run() { for (k <- 0 until rep) { for (i <- 0 until sz) trie.putIfAbsent(new Wrap(i), i) match { @@ -108,85 +108,85 @@ object SnapshotSpec extends Spec { } } } - + // removes all the elements from the trie class Remover(trie: TrieMap[Wrap, Int], index: Int, totremovers: Int, sz: Int) extends Thread { setName("Remover %d".format(index)) - + override def run() { for (i <- 0 until sz) trie.remove(new Wrap((i + sz / totremovers * index) % sz)) } } - + "have a consistent quiescent read-only snapshot" in { val sz = 10000 val N = 100 val W = 10 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val readonly = ct.readOnlySnapshot() val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) consistentReadOnly("qm", readonly, sz, N) threads.foreach(_.join()) } - + // now, we check non-quiescent snapshots, as these permit situations // where a thread is caught in the middle of the update when a snapshot is taken - + "have a consistent non-quiescent read-only snapshot, concurrent with removes only" in { val sz = 1250 val W = 100 val S = 5000 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Remover(ct, i, W, sz) - + threads.foreach(_.start()) for (i <- 0 until S) consistentReadOnly("non-qr", ct.readOnlySnapshot(), sz, 5) threads.foreach(_.join()) } - + "have a consistent non-quiescent read-only snapshot, concurrent with modifications" in { val sz = 1000 val N = 7000 val W = 10 val S = 7000 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) for (i <- 0 until S) consistentReadOnly("non-qm", ct.readOnlySnapshot(), sz, 5) threads.foreach(_.join()) } - + def consistentNonReadOnly(name: String, trie: TrieMap[Wrap, Int], sz: Int, N: Int) { @volatile var e: Exception = null - + // reads possible entries once and stores them // then reads all these N more times to check if the // state stayed the same class Worker extends Thread { setName("Worker " + name) - + override def run() = try check() catch { case ex: Exception => e = ex } - + def check() { val initial = mutable.Map[Wrap, Int]() for (i <- 0 until sz) trie.get(new Wrap(i)) match { case Some(i) => initial.put(new Wrap(i), i) case None => // do nothing } - + for (k <- 0 until N) { // modify for ((key, value) <- initial) { @@ -194,7 +194,7 @@ object SnapshotSpec extends Spec { val newv = -oldv trie.replace(key, oldv, newv) } - + // check for (i <- 0 until sz) if (initial.contains(new Wrap(i))) { val expected = if (k % 2 == 0) -i else i @@ -206,27 +206,27 @@ object SnapshotSpec extends Spec { } } } - + val worker = new Worker worker.start() worker.join() - + if (e ne null) { e.printStackTrace() throw e } } - + "have a consistent non-quiescent snapshot, concurrent with modifications" in { val sz = 9000 val N = 1000 val W = 10 val S = 400 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) for (i <- 0 until S) { consistentReadOnly("non-qm", ct.snapshot(), sz, 5) @@ -234,7 +234,7 @@ object SnapshotSpec extends Spec { } threads.foreach(_.join()) } - + "work when many concurrent snapshots are taken, concurrent with modifications" in { val sz = 12000 val W = 10 @@ -243,7 +243,7 @@ object SnapshotSpec extends Spec { val snaptimes = 600 val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i - + class Snapshooter extends Thread { setName("Snapshooter") override def run() { @@ -254,14 +254,14 @@ object SnapshotSpec extends Spec { } } } - + val mods = for (i <- 0 until W) yield new Modifier(ct, i, modifytimes, sz) val shooters = for (i <- 0 until S) yield new Snapshooter val threads = mods ++ shooters threads.foreach(_.start()) threads.foreach(_.join()) } - + } - + } diff --git a/test/files/run/ctries-old/concmap.scala b/test/files/run/ctries-old/concmap.scala index fccd4bed3e..affc6fe294 100644 --- a/test/files/run/ctries-old/concmap.scala +++ b/test/files/run/ctries-old/concmap.scala @@ -6,17 +6,17 @@ import Test.Spec object ConcurrentMapSpec extends Spec { - + val initsz = 500 val secondsz = 750 - + def test() { "support put" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) assert(ct.put(new Wrap(i), i) == None) for (i <- 0 until initsz) assert(ct.put(new Wrap(i), -i) == Some(i)) } - + "support put if absent" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -25,7 +25,7 @@ object ConcurrentMapSpec extends Spec { for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), -i) == None) for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), i) == Some(-i)) } - + "support remove if mapped to a specific value" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -33,7 +33,7 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == true) for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == false) } - + "support replace if mapped to a specific value" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -42,7 +42,7 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i, -i - 2) == false) for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i, 0) == false) } - + "support replace if present" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -50,17 +50,17 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i) == Some(-i)) for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i) == None) } - + def assertEqual(a: Any, b: Any) = { if (a != b) println(a, b) assert(a == b) } - + "support replace if mapped to a specific value, using several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 55000 for (i <- 0 until sz) ct.update(new Wrap(i), i) - + class Updater(index: Int, offs: Int) extends Thread { override def run() { var repeats = 0 @@ -75,24 +75,24 @@ object ConcurrentMapSpec extends Spec { //println("Thread %d repeats: %d".format(index, repeats)) } } - + val threads = for (i <- 0 until 16) yield new Updater(i, sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), i) - + val threads2 = for (i <- 0 until 15) yield new Updater(i, sz / 32 * i) threads2.foreach(_.start()) threads2.foreach(_.join()) - + for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), -i) } - + "support put if absent, several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 110000 - + class Updater(offs: Int) extends Thread { override def run() { for (i <- 0 until sz) { @@ -102,19 +102,19 @@ object ConcurrentMapSpec extends Spec { } } } - + val threads = for (i <- 0 until 16) yield new Updater(sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assert(ct(new Wrap(i)) == i) } - + "support remove if mapped to a specific value, several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 55000 for (i <- 0 until sz) ct.update(new Wrap(i), i) - + class Remover(offs: Int) extends Thread { override def run() { for (i <- 0 until sz) { @@ -124,19 +124,19 @@ object ConcurrentMapSpec extends Spec { } } } - + val threads = for (i <- 0 until 16) yield new Remover(sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assert(ct.get(new Wrap(i)) == None) } - + "have all or none of the elements depending on the oddity" in { val ct = new TrieMap[Wrap, Int] val sz = 65000 for (i <- 0 until sz) ct(new Wrap(i)) = i - + class Modifier(index: Int, offs: Int) extends Thread { override def run() { for (j <- 0 until sz) { @@ -152,38 +152,38 @@ object ConcurrentMapSpec extends Spec { } } } - + def modify(n: Int) = { val threads = for (i <- 0 until n) yield new Modifier(i, sz / n * i) threads.foreach(_.start()) threads.foreach(_.join()) } - + modify(16) for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), Some(i)) modify(15) for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), None) } - + "compute size correctly" in { val ct = new TrieMap[Wrap, Int] val sz = 36450 for (i <- 0 until sz) ct(new Wrap(i)) = i - + assertEqual(ct.size, sz) assertEqual(ct.size, sz) } - + "compute size correctly in parallel" in { val ct = new TrieMap[Wrap, Int] val sz = 36450 for (i <- 0 until sz) ct(new Wrap(i)) = i val pct = ct.par - + assertEqual(pct.size, sz) assertEqual(pct.size, sz) } - + } - + } diff --git a/test/files/run/ctries-old/iterator.scala b/test/files/run/ctries-old/iterator.scala index 585bdc0e48..127f6c9f06 100644 --- a/test/files/run/ctries-old/iterator.scala +++ b/test/files/run/ctries-old/iterator.scala @@ -9,126 +9,126 @@ import Test.Spec object IteratorSpec extends Spec { - + def test() { "work for an empty trie" in { val ct = new TrieMap val it = ct.iterator - + it.hasNext shouldEqual (false) evaluating { it.next() }.shouldProduce [NoSuchElementException] } - + def nonEmptyIteratorCheck(sz: Int) { val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.put(new Wrap(i), i) - + val it = ct.iterator val tracker = mutable.Map[Wrap, Int]() for (i <- 0 until sz) { assert(it.hasNext == true) tracker += it.next } - + it.hasNext shouldEqual (false) evaluating { it.next() }.shouldProduce [NoSuchElementException] tracker.size shouldEqual (sz) tracker shouldEqual (ct) } - + "work for a 1 element trie" in { nonEmptyIteratorCheck(1) } - + "work for a 2 element trie" in { nonEmptyIteratorCheck(2) } - + "work for a 3 element trie" in { nonEmptyIteratorCheck(3) } - + "work for a 5 element trie" in { nonEmptyIteratorCheck(5) } - + "work for a 10 element trie" in { nonEmptyIteratorCheck(10) } - + "work for a 20 element trie" in { nonEmptyIteratorCheck(20) } - + "work for a 50 element trie" in { nonEmptyIteratorCheck(50) } - + "work for a 100 element trie" in { nonEmptyIteratorCheck(100) } - + "work for a 1k element trie" in { nonEmptyIteratorCheck(1000) } - + "work for a 5k element trie" in { nonEmptyIteratorCheck(5000) } - + "work for a 75k element trie" in { nonEmptyIteratorCheck(75000) } - + "work for a 250k element trie" in { nonEmptyIteratorCheck(500000) } - + def nonEmptyCollideCheck(sz: Int) { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until sz) ct.put(new DumbHash(i), i) - + val it = ct.iterator val tracker = mutable.Map[DumbHash, Int]() for (i <- 0 until sz) { assert(it.hasNext == true) tracker += it.next } - + it.hasNext shouldEqual (false) evaluating { it.next() }.shouldProduce [NoSuchElementException] tracker.size shouldEqual (sz) tracker shouldEqual (ct) } - + "work for colliding hashcodes, 2 element trie" in { nonEmptyCollideCheck(2) } - + "work for colliding hashcodes, 3 element trie" in { nonEmptyCollideCheck(3) } - + "work for colliding hashcodes, 5 element trie" in { nonEmptyCollideCheck(5) } - + "work for colliding hashcodes, 10 element trie" in { nonEmptyCollideCheck(10) } - + "work for colliding hashcodes, 100 element trie" in { nonEmptyCollideCheck(100) } - + "work for colliding hashcodes, 500 element trie" in { nonEmptyCollideCheck(500) } - + "work for colliding hashcodes, 5k element trie" in { nonEmptyCollideCheck(5000) } - + def assertEqual(a: Map[Wrap, Int], b: Map[Wrap, Int]) { if (a != b) { println(a.size + " vs " + b.size) @@ -139,7 +139,7 @@ object IteratorSpec extends Spec { } assert(a == b) } - + "be consistent when taken with concurrent modifications" in { val sz = 25000 val W = 15 @@ -147,40 +147,40 @@ object IteratorSpec extends Spec { val checks = 5 val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.put(new Wrap(i), i) - + class Modifier extends Thread { override def run() { for (i <- 0 until sz) ct.putIfAbsent(new Wrap(i), i) match { case Some(_) => ct.remove(new Wrap(i)) - case None => + case None => } } } - + def consistentIteration(ct: TrieMap[Wrap, Int], checks: Int) { class Iter extends Thread { override def run() { val snap = ct.readOnlySnapshot() val initial = mutable.Map[Wrap, Int]() for (kv <- snap) initial += kv - + for (i <- 0 until checks) { assertEqual(snap.iterator.toMap, initial) } } } - + val iter = new Iter iter.start() iter.join() } - + val threads = for (_ <- 0 until W) yield new Modifier threads.foreach(_.start()) for (_ <- 0 until S) consistentIteration(ct, checks) threads.foreach(_.join()) } - + "be consistent with a concurrent removal with a well defined order" in { val sz = 150000 val sgroupsize = 10 @@ -188,7 +188,7 @@ object IteratorSpec extends Spec { val removerslowdown = 50 val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.put(new Wrap(i), i) - + class Remover extends Thread { override def run() { for (i <- 0 until sz) { @@ -198,7 +198,7 @@ object IteratorSpec extends Spec { //println("done removing") } } - + def consistentIteration(it: Iterator[(Wrap, Int)]) = { class Iter extends Thread { override def run() { @@ -211,7 +211,7 @@ object IteratorSpec extends Spec { } new Iter } - + val remover = new Remover remover.start() for (_ <- 0 until sgroupnum) { @@ -222,14 +222,14 @@ object IteratorSpec extends Spec { //println("done with iterators") remover.join() } - + "be consistent with a concurrent insertion with a well defined order" in { val sz = 150000 val sgroupsize = 10 val sgroupnum = 10 val inserterslowdown = 50 val ct = new TrieMap[Wrap, Int] - + class Inserter extends Thread { override def run() { for (i <- 0 until sz) { @@ -239,7 +239,7 @@ object IteratorSpec extends Spec { //println("done inserting") } } - + def consistentIteration(it: Iterator[(Wrap, Int)]) = { class Iter extends Thread { override def run() { @@ -252,7 +252,7 @@ object IteratorSpec extends Spec { } new Iter } - + val inserter = new Inserter inserter.start() for (_ <- 0 until sgroupnum) { @@ -263,28 +263,28 @@ object IteratorSpec extends Spec { //println("done with iterators") inserter.join() } - + "work on a yet unevaluated snapshot" in { val sz = 50000 val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.update(new Wrap(i), i) - + val snap = ct.snapshot() val it = snap.iterator - + while (it.hasNext) it.next() } - + "be duplicated" in { val sz = 50 val ct = collection.parallel.mutable.ParTrieMap((0 until sz) zip (0 until sz): _*) val it = ct.splitter for (_ <- 0 until (sz / 2)) it.next() val dupit = it.dup - + it.toList shouldEqual dupit.toList } - + } - + } diff --git a/test/files/run/ctries-old/lnode.scala b/test/files/run/ctries-old/lnode.scala index 3ff5414ac0..f9eb9ce877 100644 --- a/test/files/run/ctries-old/lnode.scala +++ b/test/files/run/ctries-old/lnode.scala @@ -6,23 +6,23 @@ import collection.concurrent.TrieMap import Test.Spec object LNodeSpec extends Spec { - + val initsz = 1500 val secondsz = 1750 - + def test() { "accept elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) } - + "lookup elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == Some(i)) for (i <- initsz until secondsz) assert(ct.get(new DumbHash(i)) == None) } - + "remove elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) @@ -32,7 +32,7 @@ object LNodeSpec extends Spec { } for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == None) } - + "put elements with the same hash codes if absent" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.put(new DumbHash(i), i) @@ -41,7 +41,7 @@ object LNodeSpec extends Spec { for (i <- initsz until secondsz) assert(ct.putIfAbsent(new DumbHash(i), i) == None) for (i <- initsz until secondsz) assert(ct.lookup(new DumbHash(i)) == i) } - + "replace elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None) @@ -50,13 +50,13 @@ object LNodeSpec extends Spec { for (i <- 0 until initsz) assert(ct.lookup(new DumbHash(i)) == -i) for (i <- 0 until initsz) assert(ct.replace(new DumbHash(i), -i, i) == true) } - + "remove elements with the same hash codes if mapped to a specific value" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None) for (i <- 0 until initsz) assert(ct.remove(new DumbHash(i), i) == true) } - + } - + } diff --git a/test/files/run/ctries-old/snapshot.scala b/test/files/run/ctries-old/snapshot.scala index 768b588f81..dfc2034e56 100644 --- a/test/files/run/ctries-old/snapshot.scala +++ b/test/files/run/ctries-old/snapshot.scala @@ -9,22 +9,22 @@ import Test.Spec object SnapshotSpec extends Spec { - + def test() { "support snapshots" in { val ctn = new TrieMap ctn.snapshot() ctn.readOnlySnapshot() - + val ct = new TrieMap[Int, Int] for (i <- 0 until 100) ct.put(i, i) ct.snapshot() ct.readOnlySnapshot() } - + "empty 2 quiescent snapshots in isolation" in { val sz = 4000 - + class Worker(trie: TrieMap[Wrap, Int]) extends Thread { override def run() { for (i <- 0 until sz) { @@ -35,46 +35,46 @@ object SnapshotSpec extends Spec { } } } - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.put(new Wrap(i), i) val snapt = ct.snapshot() - + val original = new Worker(ct) val snapshot = new Worker(snapt) original.start() snapshot.start() original.join() snapshot.join() - + for (i <- 0 until sz) { assert(ct.get(new Wrap(i)) == None) assert(snapt.get(new Wrap(i)) == None) } } - + def consistentReadOnly(name: String, readonly: Map[Wrap, Int], sz: Int, N: Int) { @volatile var e: Exception = null - + // reads possible entries once and stores them // then reads all these N more times to check if the // state stayed the same class Reader(trie: Map[Wrap, Int]) extends Thread { setName("Reader " + name) - + override def run() = try check() catch { case ex: Exception => e = ex } - + def check() { val initial = mutable.Map[Wrap, Int]() for (i <- 0 until sz) trie.get(new Wrap(i)) match { case Some(i) => initial.put(new Wrap(i), i) case None => // do nothing } - + for (k <- 0 until N) { for (i <- 0 until sz) { val tres = trie.get(new Wrap(i)) @@ -85,21 +85,21 @@ object SnapshotSpec extends Spec { } } } - + val reader = new Reader(readonly) reader.start() reader.join() - + if (e ne null) { e.printStackTrace() throw e } } - + // traverses the trie `rep` times and modifies each entry class Modifier(trie: TrieMap[Wrap, Int], index: Int, rep: Int, sz: Int) extends Thread { setName("Modifier %d".format(index)) - + override def run() { for (k <- 0 until rep) { for (i <- 0 until sz) trie.putIfAbsent(new Wrap(i), i) match { @@ -109,85 +109,85 @@ object SnapshotSpec extends Spec { } } } - + // removes all the elements from the trie class Remover(trie: TrieMap[Wrap, Int], index: Int, totremovers: Int, sz: Int) extends Thread { setName("Remover %d".format(index)) - + override def run() { for (i <- 0 until sz) trie.remove(new Wrap((i + sz / totremovers * index) % sz)) } } - + "have a consistent quiescent read-only snapshot" in { val sz = 10000 val N = 100 val W = 10 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val readonly = ct.readOnlySnapshot() val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) consistentReadOnly("qm", readonly, sz, N) threads.foreach(_.join()) } - + // now, we check non-quiescent snapshots, as these permit situations // where a thread is caught in the middle of the update when a snapshot is taken - + "have a consistent non-quiescent read-only snapshot, concurrent with removes only" in { val sz = 1250 val W = 100 val S = 5000 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Remover(ct, i, W, sz) - + threads.foreach(_.start()) for (i <- 0 until S) consistentReadOnly("non-qr", ct.readOnlySnapshot(), sz, 5) threads.foreach(_.join()) } - + "have a consistent non-quiescent read-only snapshot, concurrent with modifications" in { val sz = 1000 val N = 7000 val W = 10 val S = 7000 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) for (i <- 0 until S) consistentReadOnly("non-qm", ct.readOnlySnapshot(), sz, 5) threads.foreach(_.join()) } - + def consistentNonReadOnly(name: String, trie: TrieMap[Wrap, Int], sz: Int, N: Int) { @volatile var e: Exception = null - + // reads possible entries once and stores them // then reads all these N more times to check if the // state stayed the same class Worker extends Thread { setName("Worker " + name) - + override def run() = try check() catch { case ex: Exception => e = ex } - + def check() { val initial = mutable.Map[Wrap, Int]() for (i <- 0 until sz) trie.get(new Wrap(i)) match { case Some(i) => initial.put(new Wrap(i), i) case None => // do nothing } - + for (k <- 0 until N) { // modify for ((key, value) <- initial) { @@ -195,7 +195,7 @@ object SnapshotSpec extends Spec { val newv = -oldv trie.replace(key, oldv, newv) } - + // check for (i <- 0 until sz) if (initial.contains(new Wrap(i))) { val expected = if (k % 2 == 0) -i else i @@ -207,27 +207,27 @@ object SnapshotSpec extends Spec { } } } - + val worker = new Worker worker.start() worker.join() - + if (e ne null) { e.printStackTrace() throw e } } - + "have a consistent non-quiescent snapshot, concurrent with modifications" in { val sz = 9000 val N = 1000 val W = 10 val S = 400 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) for (i <- 0 until S) { consistentReadOnly("non-qm", ct.snapshot(), sz, 5) @@ -235,7 +235,7 @@ object SnapshotSpec extends Spec { } threads.foreach(_.join()) } - + "work when many concurrent snapshots are taken, concurrent with modifications" in { val sz = 12000 val W = 10 @@ -244,7 +244,7 @@ object SnapshotSpec extends Spec { val snaptimes = 600 val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i - + class Snapshooter extends Thread { setName("Snapshooter") override def run() { @@ -255,14 +255,14 @@ object SnapshotSpec extends Spec { } } } - + val mods = for (i <- 0 until W) yield new Modifier(ct, i, modifytimes, sz) val shooters = for (i <- 0 until S) yield new Snapshooter val threads = mods ++ shooters threads.foreach(_.start()) threads.foreach(_.join()) } - + } - + } diff --git a/test/files/run/dead-code-elimination.scala b/test/files/run/dead-code-elimination.scala index 1af17c936b..fd3f2a996a 100644 --- a/test/files/run/dead-code-elimination.scala +++ b/test/files/run/dead-code-elimination.scala @@ -1,9 +1,9 @@ -// This testcase is a snippet that did not compile correctly under -// pre-release 2.10.x. The relevant discussion around it can be +// This testcase is a snippet that did not compile correctly under +// pre-release 2.10.x. The relevant discussion around it can be // found at: // https://groups.google.com/forum/?fromgroups#!topic/scala-internals/qcyTjk8euUI[1-25] -// +// // The reason it did not compile is related to the fact that ICode // ops did not correctly define the stack entries they consumed and // the dead code elimination phase was unable to correctly reconstruct @@ -12,7 +12,7 @@ // Originally, this did not compile, but I included it in the run // tests because this was ASM-dependand and did not happen for GenJVM. // -// Thus, we run the code and force the loading of class B -- if the +// Thus, we run the code and force the loading of class B -- if the // bytecode is incorrect, it will fail the test. final class A { @@ -27,7 +27,7 @@ final class A { object Test { def main(args: Array[String]): Unit = { - // force the loading of B + // force the loading of B (new A).f } } diff --git a/test/files/run/distinct.scala b/test/files/run/distinct.scala index 37bbe7805a..0b8971e8a9 100644 --- a/test/files/run/distinct.scala +++ b/test/files/run/distinct.scala @@ -5,7 +5,7 @@ object Test { val alphabet = 'a' to 'z' mkString "" val alphaList = ('a' to 'z').toList def shuffled = util.Random.shuffle(alphaList) - + def main(args: Array[String]): Unit = { val longList = alphaList ++ (1 to 9 flatMap (_ => shuffled)) val result = longList.distinct mkString "" diff --git a/test/files/run/elidable-noflags.scala b/test/files/run/elidable-noflags.scala index 5192e34096..1b9c5118bb 100644 --- a/test/files/run/elidable-noflags.scala +++ b/test/files/run/elidable-noflags.scala @@ -9,7 +9,7 @@ object Test { @elidable(100000) def f5() = println("Good for me, I was not elided.") @elidable(OFF) def f6() = println("Good for me, I was not elided.") @elidable(ALL) def f7() = println("ESPECIALLY good for me, I was not elided.") - + def main(args: Array[String]): Unit = { f1() f2() diff --git a/test/files/run/emptypf.scala b/test/files/run/emptypf.scala index 8aa0906a1b..eb3e3e6380 100644 --- a/test/files/run/emptypf.scala +++ b/test/files/run/emptypf.scala @@ -5,10 +5,10 @@ object Test { case s => s.length } } - + def main(args: Array[String]): Unit = { println(f("abc")) - println(f("def")) + println(f("def")) println(PartialFunction.empty[String, Int] isDefinedAt "abc") } } diff --git a/test/files/run/enrich-gentraversable.scala b/test/files/run/enrich-gentraversable.scala index 0f79a47030..36412e650e 100644 --- a/test/files/run/enrich-gentraversable.scala +++ b/test/files/run/enrich-gentraversable.scala @@ -13,22 +13,22 @@ object Test extends App { } implicit def filterMap[Repr, A](r: Repr)(implicit fr: IsTraversableLike[Repr]): FilterMapImpl[fr.A,Repr] = new FilterMapImpl[fr.A, Repr](fr.conversion(r)) - + val l = List(1, 2, 3, 4, 5) val fml = l.filterMap(i => if(i % 2 == 0) Some(i) else None) typed[List[Int]](fml) println(fml) - + val a = Array(1, 2, 3, 4, 5) val fma = a.filterMap(i => if(i % 2 == 0) Some(i) else None) typed[Array[Int]](fma) println(fma.deep) - + val s = "Hello World" val fms1 = s.filterMap(c => if(c >= 'A' && c <= 'Z') Some(c) else None) typed[String](fms1) println(fms1) - + val fms2 = s.filterMap(c =>if(c % 2 == 0) Some(c.toInt) else None) typed[IndexedSeq[Int]](fms2) println(fms2) @@ -38,28 +38,28 @@ object Test extends App { final def filterMap[B, That](f: A => Option[B])(implicit cbf: CanBuildFrom[Repr, B, That]): That = { val b = cbf() for(e <- r.seq) f(e) foreach (b +=) - + b.result } } implicit def filterMap[Repr, A](r: Repr)(implicit fr: IsTraversableOnce[Repr]): FilterMapImpl[fr.A,Repr] = new FilterMapImpl[fr.A, Repr](fr.conversion(r)) - + val l = List(1, 2, 3, 4, 5) val fml = l.filterMap(i => if(i % 2 == 0) Some(i) else None) typed[List[Int]](fml) println(fml) - + val a = Array(1, 2, 3, 4, 5) val fma = a.filterMap(i => if(i % 2 == 0) Some(i) else None) typed[Array[Int]](fma) println(fma.deep) - + val s = "Hello World" val fms1 = s.filterMap(c => if(c >= 'A' && c <= 'Z') Some(c) else None) typed[String](fms1) println(fms1) - + val fms2 = s.filterMap(c =>if(c % 2 == 0) Some(c.toInt) else None) typed[IndexedSeq[Int]](fms2) println(fms2) diff --git a/test/files/run/equality.scala b/test/files/run/equality.scala index 68055fd012..ff59898821 100644 --- a/test/files/run/equality.scala +++ b/test/files/run/equality.scala @@ -2,7 +2,7 @@ object Test { import scala.runtime.ScalaRunTime.hash - + def makeFromInt(x: Int) = List( x.toByte, x.toShort, x.toInt, x.toLong, x.toFloat, x.toDouble, BigInt(x), BigDecimal(x) ) ::: ( @@ -11,26 +11,26 @@ object Test def makeFromDouble(x: Double) = List( x.toShort, x.toInt, x.toLong, x.toFloat, x.toDouble, BigInt(x.toInt), BigDecimal(x) ) - + def main(args: Array[String]): Unit = { var xs = makeFromInt(5) for (x <- xs ; y <- xs) { assert(x == y, x + " == " + y) assert(hash(x) == hash(y), "hash(%s) == hash(%s)".format(x, y)) } - + xs = makeFromInt(-5) for (x <- xs ; y <- xs) { assert(x == y, x + " == " + y) assert(hash(x) == hash(y), "hash(%s) == hash(%s)".format(x, y)) } - + xs = makeFromDouble(500.0) for (x <- xs ; y <- xs) { assert(x == y, x + " == " + y) assert(hash(x) == hash(y), "hash(%s) == hash(%s)".format(x, y)) } - + // negatives val bigLong = new java.util.concurrent.atomic.AtomicLong(Long.MaxValue) assert(-1 != bigLong && bigLong != -1) // bigLong.intValue() == -1 diff --git a/test/files/run/existentials.scala b/test/files/run/existentials.scala index 65acfd2ac0..bdd6fb93ee 100644 --- a/test/files/run/existentials.scala +++ b/test/files/run/existentials.scala @@ -5,7 +5,7 @@ class Foo { class Line { case class Cell[T](var x: T) def f[T](x: Any): Cell[t1] forSome { type t1 } = x match { case y: Cell[t] => y } - + var x: Cell[T] forSome { type T } = new Cell(1) println({ x = new Cell("abc"); x }) } @@ -15,7 +15,7 @@ class FooW { class Line { case class Cell[T](var x: T) def f[T](x: Any): Cell[ _ ] = x match { case y: Cell[t] => y } - + var x: Cell[_] = new Cell(1) println({ x = new Cell("abc"); x }) } diff --git a/test/files/run/finally.scala b/test/files/run/finally.scala index 01180fd217..2c01edaaef 100644 --- a/test/files/run/finally.scala +++ b/test/files/run/finally.scala @@ -10,7 +10,7 @@ object Test extends App { case e: Throwable => println(e) } } - + // test that finally is not covered by any exception handlers. def bar { try { @@ -26,7 +26,7 @@ object Test extends App { } // return in catch (finally is executed) - def retCatch { + def retCatch { try { throw new Exception } catch { @@ -37,7 +37,7 @@ object Test extends App { } // throw in catch (finally is executed, exception propagated) - def throwCatch { + def throwCatch { try { throw new Exception } catch { @@ -48,7 +48,7 @@ object Test extends App { } // return inside body (finally is executed) - def retBody { + def retBody { try { return } catch { @@ -75,7 +75,7 @@ object Test extends App { finally { println("in finally 1") return - } + } } finally println("in finally 2") } @@ -94,7 +94,7 @@ object Test extends App { } // nested finallies with return value - def nestedFinalies: Int = + def nestedFinalies: Int = try { try { return 10 diff --git a/test/files/run/flat-flat-flat.scala b/test/files/run/flat-flat-flat.scala index d57696b3a3..80868b9c5e 100644 --- a/test/files/run/flat-flat-flat.scala +++ b/test/files/run/flat-flat-flat.scala @@ -2,7 +2,7 @@ object Test { def f1 = List(Iterator(Some(1), None, Some(2)), Iterator(Some(3), None)) def f2 = Iterator(List(Some(1), None, Some(2)), List(Some(3), None), Nil) def f3 = List(Some(Iterator(1)), None, Some(Iterator(2, 3))) - + def main(args: Array[String]): Unit = { assert(f1.flatten.flatten.toList == List(1, 2, 3)) assert(f2.flatten.flatten.toList == List(1, 2, 3)) diff --git a/test/files/run/forvaleq.scala b/test/files/run/forvaleq.scala index 2a958802b6..8c1824a769 100644 --- a/test/files/run/forvaleq.scala +++ b/test/files/run/forvaleq.scala @@ -2,7 +2,7 @@ import scala.collection.immutable.Queue import scala.{List=>L} - + object Test { // redefine some symbols to make it extra hard class List @@ -16,11 +16,11 @@ object Test { case _ if (x<10) => x case _ => firstDigit(x / 10) } - - + + { - // a basic test case - + // a basic test case + val input = L.range(0,20) val oddFirstTimesTwo = for {x <- input @@ -32,7 +32,7 @@ object Test { { // a test case with patterns - + val input = L.range(0, 20) val oddFirstTimesTwo = for {x <- input @@ -43,10 +43,10 @@ object Test { yield a + b println(oddFirstTimesTwo) } - + { // make sure it works on non-Ls - + // val input: Queue = Queue.Empty[int].incl(L.range(0,20)) val input = L.range(0, 20).iterator val oddFirstTimesTwo = @@ -54,36 +54,36 @@ object Test { xf = firstDigit(x) if xf % 2 == 1} yield x*2 - println(oddFirstTimesTwo.toList) + println(oddFirstTimesTwo.toList) } - + { // yield the computed value - + val input = L.range(0,20) val oddFirstTimesTwo = for {x <- input xf = firstDigit(x) if xf % 2 == 1} yield xf*2 - println(oddFirstTimesTwo) + println(oddFirstTimesTwo) } { // make sure the function is only called once var count: Int = 0 - + def fdct(x: Int) = { count += 1 firstDigit(x) } - + val input = L.range(0,20) for {x <- input xf = fdct(x) if xf % 2 == 1} yield xf - + println("called " + count + " times") } diff --git a/test/files/run/gadts.scala b/test/files/run/gadts.scala index 4ab3ef681a..57c7fc8af0 100644 --- a/test/files/run/gadts.scala +++ b/test/files/run/gadts.scala @@ -2,8 +2,8 @@ abstract class Term[T] case class Lit(x: Int) extends Term[Int] case class Succ(t: Term[Int]) extends Term[Int] case class IsZero(t: Term[Int]) extends Term[Boolean] -case class If[T](c: Term[Boolean], - t1: Term[T], +case class If[T](c: Term[Boolean], + t1: Term[T], t2: Term[T]) extends Term[T] object Test extends App { diff --git a/test/files/run/global-showdef.scala b/test/files/run/global-showdef.scala index 2a00ee51bd..0dbaba979d 100644 --- a/test/files/run/global-showdef.scala +++ b/test/files/run/global-showdef.scala @@ -40,8 +40,8 @@ object Bippy { new Global(settings) } - - def slurp(body: => Unit): String = stringFromStream { stream => + + def slurp(body: => Unit): String = stringFromStream { stream => Console.withOut(stream) { Console.withErr(stream) { body @@ -58,11 +58,11 @@ object Bippy { } def showClass(name: String) = lines("-Yshow:typer", "-Xshow-class", name) def showObject(name: String) = lines("-Yshow:typer", "-Xshow-object", name) - + def show(xs: List[String]) = { xs filter (x => (x contains "def showdefTestMember") || (x startsWith "<<-- ")) foreach println } - + def main(args: Array[String]) { show(List("Bippy", "Bippy#BippyType", "Bippy.BippyType", "Bippy#Boppity", "Bippy#Boppity#Boo") flatMap showClass) show(List("Bippy", "Bippy#Boppity#Boo") flatMap showObject) diff --git a/test/files/run/groupby.scala b/test/files/run/groupby.scala index fe08f52812..a751e65e80 100644 --- a/test/files/run/groupby.scala +++ b/test/files/run/groupby.scala @@ -3,8 +3,8 @@ // Fixes #3422 object Test { - - def main(args: Array[String]) { + + def main(args: Array[String]) { val arr = Array.range(0,10) val map = arr groupBy (_%2) val v1 = map(0) @@ -14,5 +14,5 @@ object Test { // hash map by default. assert(v1 eq v2) } - + } diff --git a/test/files/run/hashCodeBoxesRunTime.scala b/test/files/run/hashCodeBoxesRunTime.scala index 081a73376e..ba1a30f5fb 100644 --- a/test/files/run/hashCodeBoxesRunTime.scala +++ b/test/files/run/hashCodeBoxesRunTime.scala @@ -4,16 +4,16 @@ object Test { import java.{ lang => jl } import scala.runtime.BoxesRunTime.{ hashFromNumber, hashFromObject } - + def allSame[T](xs: List[T]) = assert(xs.distinct.size == 1, "failed: " + xs) - + def mkNumbers(x: Int): List[Number] = List(x.toByte, x.toShort, x, x.toLong, x.toFloat, x.toDouble) - + def testLDF(x: Long) = allSame(List[Number](x, x.toDouble, x.toFloat) map hashFromNumber) - + def main(args: Array[String]): Unit = { - List(Byte.MinValue, -1, 0, 1, Byte.MaxValue) foreach { n => + List(Byte.MinValue, -1, 0, 1, Byte.MaxValue) foreach { n => val hashes = mkNumbers(n) map hashFromNumber allSame(hashes) if (n >= 0) { @@ -21,7 +21,7 @@ object Test assert(charCode == hashes.head) } } - + testLDF(Short.MaxValue.toLong) testLDF(Short.MinValue.toLong) } diff --git a/test/files/run/hashhash.scala b/test/files/run/hashhash.scala index f9fc067398..3b9d1479cf 100644 --- a/test/files/run/hashhash.scala +++ b/test/files/run/hashhash.scala @@ -1,7 +1,7 @@ object Test { def confirmSame(x: Any) = assert(x.## == x.hashCode, "%s.## != %s.hashCode".format(x, x)) def confirmDifferent(x: Any) = assert(x.## != x.hashCode, "%s.## == %s.hashCode (but should not)".format(x, x)) - + def main(args: Array[String]): Unit = { /** Just a little sanity check, not to be confused with a unit test. */ List(5, 5.5f, "abc", new AnyRef, ()) foreach confirmSame diff --git a/test/files/run/hashset.scala b/test/files/run/hashset.scala index 299dce3aec..a4d49c142e 100644 --- a/test/files/run/hashset.scala +++ b/test/files/run/hashset.scala @@ -40,9 +40,9 @@ object Test extends App { println((for (i <- 0 until 20) yield i + " " + (h2 contains ("" + i))).toList.sorted mkString(",")) println } - + trait Creator { - def create[A] : GenSet[A] with Cloneable with FlatHashTable[A] with Growable[A] with Shrinkable[A] + def create[A] : GenSet[A] with Cloneable with FlatHashTable[A] with Growable[A] with Shrinkable[A] def hashSetType : String } }
\ No newline at end of file diff --git a/test/files/run/indexedSeq.scala b/test/files/run/indexedSeq.scala index 29a8be701d..b1a2b1bc60 100644 --- a/test/files/run/indexedSeq.scala +++ b/test/files/run/indexedSeq.scala @@ -1,8 +1,8 @@ object Test { import scala.collection.immutable - + def checkIdentity[A](xs: immutable.IndexedSeq[A]) = assert(xs.toIndexedSeq eq xs) - + def main(args: Array[String]): Unit = { def r = 1 to 10 checkIdentity(immutable.Vector(r: _*)) diff --git a/test/files/run/infix.scala b/test/files/run/infix.scala index 700e4347ac..a867d03ce8 100644 --- a/test/files/run/infix.scala +++ b/test/files/run/infix.scala @@ -9,4 +9,3 @@ object Test extends App { case null op (0, 0) op (1, 1) op (2, 2) => Console.println("OK") } } - diff --git a/test/files/run/inliner-infer.scala b/test/files/run/inliner-infer.scala index ea83966c52..e41d6ae5c7 100644 --- a/test/files/run/inliner-infer.scala +++ b/test/files/run/inliner-infer.scala @@ -7,8 +7,8 @@ object Test extends App { @annotation.tailrec def walk(xs: MyList): Unit = { - if (xs.isEmpty) - println("empty") + if (xs.isEmpty) + println("empty") else { println("non-empty") walk(MyNil) @@ -26,4 +26,3 @@ object MyNil extends MyList { override def isEmpty = true } - diff --git a/test/files/run/inner-obj-auto.scala b/test/files/run/inner-obj-auto.scala index 35ca56ba3e..00ea5119cc 100644 --- a/test/files/run/inner-obj-auto.scala +++ b/test/files/run/inner-obj-auto.scala @@ -3,15 +3,15 @@ /* ================================================================================ Automatically generated on 2011-05-11. Do Not Edit (unless you have to). (2-level nesting) - ================================================================================ */ + ================================================================================ */ class Class2_1 { - + class Class1_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -31,16 +31,16 @@ class Class2_1 { def run { runTest } } - + def run { (new Class1_2).run } } object Object3_1 { - + class Class1_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -60,16 +60,16 @@ object Object3_1 { def run { runTest } } - + def run { (new Class1_2).run } // trigger } trait Trait4_1 { - + class Class1_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -89,16 +89,16 @@ trait Trait4_1 { def run { runTest } } - + def run { (new Class1_2).run } } class Class6_1 { - + object Object5_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -118,16 +118,16 @@ class Class6_1 { def run { runTest } // trigger } - + def run { Object5_2.run } } object Object7_1 { - + object Object5_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -147,16 +147,16 @@ object Object7_1 { def run { runTest } // trigger } - + def run { Object5_2.run } // trigger } trait Trait8_1 { - + object Object5_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -176,16 +176,16 @@ trait Trait8_1 { def run { runTest } // trigger } - + def run { Object5_2.run } } class Class10_1 { - + trait Trait9_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -205,16 +205,16 @@ class Class10_1 { def run { runTest } } - + def run { (new Trait9_2 {}).run } } object Object11_1 { - + trait Trait9_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -234,16 +234,16 @@ object Object11_1 { def run { runTest } } - + def run { (new Trait9_2 {}).run } // trigger } trait Trait12_1 { - + trait Trait9_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -263,16 +263,16 @@ trait Trait12_1 { def run { runTest } } - + def run { (new Trait9_2 {}).run } } class Class14_1 { - + def method13_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -292,16 +292,16 @@ class Class14_1 { runTest // trigger } - + def run { method13_2 } } object Object15_1 { - + def method13_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -321,16 +321,16 @@ object Object15_1 { runTest // trigger } - + def run { method13_2 } // trigger } trait Trait16_1 { - + def method13_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -350,16 +350,16 @@ trait Trait16_1 { runTest // trigger } - + def run { method13_2 } } class Class18_1 { - + private def method17_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -379,16 +379,16 @@ class Class18_1 { runTest // trigger } - + def run { method17_2 } } object Object19_1 { - + private def method17_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -408,16 +408,16 @@ object Object19_1 { runTest // trigger } - + def run { method17_2 } // trigger } trait Trait20_1 { - + private def method17_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -437,16 +437,16 @@ trait Trait20_1 { runTest // trigger } - + def run { method17_2 } } class Class22_1 { - + val fun21_2 = () => { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -466,16 +466,16 @@ class Class22_1 { runTest // trigger } - + def run { fun21_2() } } object Object23_1 { - + val fun21_2 = () => { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -495,16 +495,16 @@ object Object23_1 { runTest // trigger } - + def run { fun21_2() } // trigger } trait Trait24_1 { - + val fun21_2 = () => { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -524,17 +524,17 @@ trait Trait24_1 { runTest // trigger } - + def run { fun21_2() } } class Class26_1 { - + class Class25_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -553,19 +553,19 @@ class Class26_1 { } runTest // trigger - } + } } - + def run { (new Class25_2) } } object Object27_1 { - + class Class25_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -584,19 +584,19 @@ object Object27_1 { } runTest // trigger - } + } } - + def run { (new Class25_2) } // trigger } trait Trait28_1 { - + class Class25_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -615,19 +615,19 @@ trait Trait28_1 { } runTest // trigger - } + } } - + def run { (new Class25_2) } } class Class30_1 { - + trait Trait29_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -646,19 +646,19 @@ class Class30_1 { } runTest // trigger - } + } } - + def run { (new Trait29_2 {}) } } object Object31_1 { - + trait Trait29_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -677,19 +677,19 @@ object Object31_1 { } runTest // trigger - } + } } - + def run { (new Trait29_2 {}) } // trigger } trait Trait32_1 { - + trait Trait29_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -708,18 +708,18 @@ trait Trait32_1 { } runTest // trigger - } + } } - + def run { (new Trait29_2 {}) } } class Class34_1 { - + lazy val lzvalue33_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -739,16 +739,16 @@ class Class34_1 { runTest // trigger } - + def run { lzvalue33_2 } } object Object35_1 { - + lazy val lzvalue33_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -768,16 +768,16 @@ object Object35_1 { runTest // trigger } - + def run { lzvalue33_2 } // trigger } trait Trait36_1 { - + lazy val lzvalue33_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -797,16 +797,16 @@ trait Trait36_1 { runTest // trigger } - + def run { lzvalue33_2 } } class Class38_1 { - + val value37_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -826,16 +826,16 @@ class Class38_1 { runTest // trigger } - + def run { value37_2 } } object Object39_1 { - + val value37_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -855,16 +855,16 @@ object Object39_1 { runTest // trigger } - + def run { value37_2 } // trigger } trait Trait40_1 { - + val value37_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -884,16 +884,16 @@ trait Trait40_1 { runTest // trigger } - + def run { value37_2 } } class Class42_1 { - + class Class41_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -913,16 +913,16 @@ class Class42_1 { def run { runTest } } - + def run { (new Class41_2).run } } object Object43_1 { - + class Class41_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -942,16 +942,16 @@ object Object43_1 { def run { runTest } } - + def run { (new Class41_2).run } // trigger } trait Trait44_1 { - + class Class41_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -971,16 +971,16 @@ trait Trait44_1 { def run { runTest } } - + def run { (new Class41_2).run } } class Class46_1 { - + object Object45_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1000,16 +1000,16 @@ class Class46_1 { def run { runTest } // trigger } - + def run { Object45_2.run } } object Object47_1 { - + object Object45_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1029,16 +1029,16 @@ object Object47_1 { def run { runTest } // trigger } - + def run { Object45_2.run } // trigger } trait Trait48_1 { - + object Object45_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1058,16 +1058,16 @@ trait Trait48_1 { def run { runTest } // trigger } - + def run { Object45_2.run } } class Class50_1 { - + trait Trait49_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1087,16 +1087,16 @@ class Class50_1 { def run { runTest } } - + def run { (new Trait49_2 {}).run } } object Object51_1 { - + trait Trait49_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1116,16 +1116,16 @@ object Object51_1 { def run { runTest } } - + def run { (new Trait49_2 {}).run } // trigger } trait Trait52_1 { - + trait Trait49_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1145,16 +1145,16 @@ trait Trait52_1 { def run { runTest } } - + def run { (new Trait49_2 {}).run } } class Class54_1 { - + class Class53_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1178,16 +1178,16 @@ class Class54_1 { def run { runTest } } - + def run { (new Class53_2).run } } object Object55_1 { - + class Class53_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1211,16 +1211,16 @@ object Object55_1 { def run { runTest } } - + def run { (new Class53_2).run } // trigger } trait Trait56_1 { - + class Class53_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1244,16 +1244,16 @@ trait Trait56_1 { def run { runTest } } - + def run { (new Class53_2).run } } class Class58_1 { - + object Object57_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1277,16 +1277,16 @@ class Class58_1 { def run { runTest } // trigger } - + def run { Object57_2.run } } object Object59_1 { - + object Object57_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1310,16 +1310,16 @@ object Object59_1 { def run { runTest } // trigger } - + def run { Object57_2.run } // trigger } trait Trait60_1 { - + object Object57_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1343,16 +1343,16 @@ trait Trait60_1 { def run { runTest } // trigger } - + def run { Object57_2.run } } class Class62_1 { - + trait Trait61_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1376,16 +1376,16 @@ class Class62_1 { def run { runTest } } - + def run { (new Trait61_2 {}).run } } object Object63_1 { - + trait Trait61_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1409,16 +1409,16 @@ object Object63_1 { def run { runTest } } - + def run { (new Trait61_2 {}).run } // trigger } trait Trait64_1 { - + trait Trait61_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1442,16 +1442,16 @@ trait Trait64_1 { def run { runTest } } - + def run { (new Trait61_2 {}).run } } class Class66_1 { - + def method65_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1475,16 +1475,16 @@ class Class66_1 { runTest // trigger } - + def run { method65_2 } } object Object67_1 { - + def method65_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1508,16 +1508,16 @@ object Object67_1 { runTest // trigger } - + def run { method65_2 } // trigger } trait Trait68_1 { - + def method65_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1541,16 +1541,16 @@ trait Trait68_1 { runTest // trigger } - + def run { method65_2 } } class Class70_1 { - + private def method69_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1574,16 +1574,16 @@ class Class70_1 { runTest // trigger } - + def run { method69_2 } } object Object71_1 { - + private def method69_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1607,16 +1607,16 @@ object Object71_1 { runTest // trigger } - + def run { method69_2 } // trigger } trait Trait72_1 { - + private def method69_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1640,16 +1640,16 @@ trait Trait72_1 { runTest // trigger } - + def run { method69_2 } } class Class74_1 { - + val fun73_2 = () => { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1673,16 +1673,16 @@ class Class74_1 { runTest // trigger } - + def run { fun73_2() } } object Object75_1 { - + val fun73_2 = () => { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1706,16 +1706,16 @@ object Object75_1 { runTest // trigger } - + def run { fun73_2() } // trigger } trait Trait76_1 { - + val fun73_2 = () => { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1739,17 +1739,17 @@ trait Trait76_1 { runTest // trigger } - + def run { fun73_2() } } class Class78_1 { - + class Class77_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1772,19 +1772,19 @@ class Class78_1 { } runTest // trigger - } + } } - + def run { (new Class77_2) } } object Object79_1 { - + class Class77_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1807,19 +1807,19 @@ object Object79_1 { } runTest // trigger - } + } } - + def run { (new Class77_2) } // trigger } trait Trait80_1 { - + class Class77_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1842,19 +1842,19 @@ trait Trait80_1 { } runTest // trigger - } + } } - + def run { (new Class77_2) } } class Class82_1 { - + trait Trait81_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1877,19 +1877,19 @@ class Class82_1 { } runTest // trigger - } + } } - + def run { (new Trait81_2 {}) } } object Object83_1 { - + trait Trait81_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1912,19 +1912,19 @@ object Object83_1 { } runTest // trigger - } + } } - + def run { (new Trait81_2 {}) } // trigger } trait Trait84_1 { - + trait Trait81_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1947,18 +1947,18 @@ trait Trait84_1 { } runTest // trigger - } + } } - + def run { (new Trait81_2 {}) } } class Class90_1 { - + val value89_2 = { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1982,16 +1982,16 @@ class Class90_1 { runTest // trigger } - + def run { value89_2 } } trait Trait92_1 { - + val value89_2 = { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -2015,7 +2015,7 @@ trait Trait92_1 { runTest // trigger } - + def run { value89_2 } } diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala index e5f9e4705a..31859cf867 100644 --- a/test/files/run/iq.scala +++ b/test/files/run/iq.scala @@ -9,8 +9,8 @@ object iq { /* Create an empty queue. */ val q: Queue[Int] = Queue.empty - /* Test isEmpty. - * Expected: Empty + /* Test isEmpty. + * Expected: Empty */ if (q.isEmpty) { Console.println("Empty") @@ -20,14 +20,14 @@ object iq { //val q2 = q + 42 + 0 // deprecated val q2 = q.enqueue(42).enqueue(0) - /* Test is empty and dequeue. + /* Test is empty and dequeue. * Expected: Head: 42 */ val q4 = if (q2.isEmpty) { Console.println("Empty") q2 - } + } else { val (head, q3) = q2.dequeue Console.println("Head: " + head) @@ -36,8 +36,8 @@ object iq { /* Test sequence enqueing. */ val q5: Queue[Any] = q4.enqueue(List(1,2,3,4,5,6,7,8,9)) - /* Test toString. - * Expected: Head: q5: Queue(0,1,2,3,4,5,6,7,8,9) + /* Test toString. + * Expected: Head: q5: Queue(0,1,2,3,4,5,6,7,8,9) */ Console.println("q5: " + q5) /* Test apply @@ -59,7 +59,7 @@ object iq { //val q8 = q7 + 10 + 11 //deprecated val q8 = q7.enqueue(10).enqueue(11) /* Test dequeu - * Expected: q8: Queue(2,3,4,5,6,7,8,9,10,11) + * Expected: q8: Queue(2,3,4,5,6,7,8,9,10,11) */ Console.println("q8: " + q8) val q9 = Queue(2,3,4,5,6,7,8,9,10,11) @@ -70,14 +70,14 @@ object iq { Console.println("q8 == q9: " + (q8 == q9)) /* Testing elements - * Expected: Elements: 1 2 3 4 5 6 7 8 9 + * Expected: Elements: 1 2 3 4 5 6 7 8 9 */ - Console.print("Elements: "); + Console.print("Elements: "); q6.iterator.foreach(e => Console.print(" "+ e + " ")) - Console.println; + Console.println; /* Testing mkString - * Expected: String: <1-2-3-4-5-6-7-8-9> + * Expected: String: <1-2-3-4-5-6-7-8-9> */ Console.println("String: " + q6.mkString("<","-",">")) @@ -89,7 +89,7 @@ object iq { /* Testing front * Expected: Front: 1 */ - Console.println("Front: " + q6.front); + Console.println("Front: " + q6.front); } } diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala index 19a3b9c7c0..d314015dd4 100644 --- a/test/files/run/is-valid-num.scala +++ b/test/files/run/is-valid-num.scala @@ -127,7 +127,7 @@ object Test { checkBigInt2(biExp2(128) - biExp2(128 - pf)) checkBigInt2(biExp2(128) - biExp2(128 - pf - 1)) checkBigInt2(biExp2(128)) - + checkBigInt2(biExp2(1023)) checkBigInt2(biExp2(1024) - biExp2(1024 - pd)) checkBigInt2(biExp2(1024) - biExp2(1024 - pd - 1)) diff --git a/test/files/run/issue192.scala b/test/files/run/issue192.scala index 3c3b44a8fb..8e6d13e5e1 100644 --- a/test/files/run/issue192.scala +++ b/test/files/run/issue192.scala @@ -1,18 +1,18 @@ import scala.language.reflectiveCalls object Test extends App { - + def f1(p: Any{def unary_+ : Int}) = +p def f2(p: Any{def unary_- : Int}) = -p def f3(p: Any{def unary_~ : Int}) = ~p def f4(p: Any{def unary_! : Boolean}) = !p - + def f5(p: Any{def +(q: Int): Int}) = p + 7 def f6(p: Any{def -(q: Int): Int}) = p - 7 def f7(p: Any{def *(q: Int): Int}) = p * 7 def f8(p: Any{def /(q: Int): Int}) = p / 7 def f9(p: Any{def %(q: Int): Int}) = p % 7 - + def f10(p: Any{def |(q: Int): Int}) = p | 7 def f11(p: Any{def |(q: Boolean): Boolean}) = p | true def f12(p: Any{def ^(q: Int): Int}) = p ^ 7 @@ -21,11 +21,11 @@ object Test extends App { def f15(p: Any{def &(q: Boolean): Boolean}) = p & true def f16(p: Any{def ||(q: Boolean): Boolean}) = p || true def f17(p: Any{def &&(q: Boolean): Boolean}) = p && true - + def f18(p: Any{def <<(q: Int): Int}) = p << 7 def f19(p: Any{def >>(q: Int): Int}) = p >> 7 def f20(p: Any{def >>>(q: Int): Int}) = p >>> 7 - + def f21(p: Any{def toByte: Byte}) = p.toByte def f22(p: Any{def toShort: Short}) = p.toShort def f23(p: Any{def toChar: Char}) = p.toChar @@ -33,28 +33,28 @@ object Test extends App { def f25(p: Any{def toLong: Long}) = p.toLong def f26(p: Any{def toFloat: Float}) = p.toFloat def f27(p: Any{def toDouble: Double}) = p.toDouble - + def f28(p: Any{def ==(q: Int): Boolean}) = p == 7 def f29(p: Any{def !=(q: Int): Boolean}) = p != 7 def f30(p: Any{def ==(q: Boolean): Boolean}) = p == true def f31(p: Any{def !=(q: Boolean): Boolean}) = p != true - + def f32(p: Any{def <(q: Int): Boolean}) = p < 7 def f33(p: Any{def <=(q: Int): Boolean}) = p <= 7 def f34(p: Any{def >=(q: Int): Boolean}) = p >= 7 def f35(p: Any{def >(q: Int): Boolean}) = p > 7 - + print("f1 = "); println(f1(1) == +1) print("f2 = "); println(f2(1) == -1) print("f3 = "); println(f3(1) == ~1) print("f4 = "); println(f4(true) == !true) - + print("f5 = "); println(f5(4) == (4 + 7)) print("f6 = "); println(f6(4) == (4 - 7)) print("f7 = "); println(f7(4) == (4 * 7)) print("f8 = "); println(f8(4) == (4 / 7)) print("f9 = "); println(f9(4) == (4 % 7)) - + print("f10 = "); println(f10(4) == (4 | 7)) print("f11 = "); println(f11(false) == (false | true)) print("f12 = "); println(f12(4) == (4 ^ 7)) @@ -63,11 +63,11 @@ object Test extends App { print("f15 = "); println(f15(false) == (false & true)) print("f16 = "); println(f16(false) == (false || true)) print("f17 = "); println(f17(false) == (false && true)) - + print("f18 = "); println(f18(4) == (4 << 7)) print("f19 = "); println(f19(-4) == (-4 >> 7)) print("f20 = "); println(f20(-4) == (-4 >>> 7)) - + print("f21 = "); println(f21(4.2) == (4.2.toByte)) print("f22 = "); println(f22(4.2) == (4.2.toShort)) print("f23 = "); println(f23(4.2) == (4.2.toChar)) @@ -75,17 +75,17 @@ object Test extends App { print("f25 = "); println(f25(4.2) == (4.2.toLong)) print("f26 = "); println(f26(4.2) == (4.2.toFloat)) print("f27 = "); println(f27(4.2) == (4.2.toDouble)) - + print("f28 = "); println(f28(4) == (4 == 7)) print("f29 = "); println(f29(4) == (4 != 7)) print("f30 = "); println(f30(false) == (false == true)) print("f31 = "); println(f31(false) == (false != true)) - + print("f32 = "); println(f32(4) == (4 < 7)) print("f33 = "); println(f33(4) == (4 <= 7)) print("f34 = "); println(f34(4) == (4 >= 7)) print("f35 = "); println(f35(4) == (4 > 7)) - + println("ok") - + } diff --git a/test/files/run/iterator-from.scala b/test/files/run/iterator-from.scala index fb33f6b5ed..269e859657 100644 --- a/test/files/run/iterator-from.scala +++ b/test/files/run/iterator-from.scala @@ -25,7 +25,7 @@ object Test extends App { } def testMap[A <% Ordered[A], B](map: SortedMap[A, B], list: List[(A, B)]) { - val distinctSorted = distinctByKey(list).sortBy(_._1) + val distinctSorted = distinctByKey(list).sortBy(_._1) assertEquals("Map size wasn't the same as list sze", map.size, distinctSorted.size) for(keyValue <- distinctSorted) { @@ -35,7 +35,7 @@ object Test extends App { check(clazz, list, s"map iteratorFrom $key", s"(map from $key).iterator", iteratorFrom, (map from key).iterator.toList) check(clazz, list, s"map iteratorFrom $key", s"distinctSorted dropWhile (_._1 < $key)", iteratorFrom, distinctSorted dropWhile (_._1 < key)) check(clazz, list, s"map iteratorFrom $key map (_._1)", s"map keysIteratorFrom $key", iteratorFrom map (_._1), (map keysIteratorFrom key).toList) - check(clazz, list, s"map iteratorFrom $key map (_._2)", s"map valuesIteratorFrom $key", iteratorFrom map (_._2), (map valuesIteratorFrom key).toList) + check(clazz, list, s"map iteratorFrom $key map (_._2)", s"map valuesIteratorFrom $key", iteratorFrom map (_._2), (map valuesIteratorFrom key).toList) } } @@ -54,7 +54,7 @@ object Test extends App { val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value } - 0 until maxLength foreach {length => + 0 until maxLength foreach {length => val keyValues = (0 until length map {_ => (R nextInt maxKey, R nextInt maxValue)}).toList val keys = keyValues map (_._2) testSet(immutable.BitSet(keys:_*), keys) diff --git a/test/files/run/iterator3444.scala b/test/files/run/iterator3444.scala index 2d0643bd56..1d0713addc 100644 --- a/test/files/run/iterator3444.scala +++ b/test/files/run/iterator3444.scala @@ -2,22 +2,22 @@ // ticked #3444 object Test { - + def main(args: Array[String]) { val it = (1 to 12).toSeq.iterator - + assert(it.next == 1) assert(it.take(2).toList == List(2, 3)) - + val jt = (4 to 12).toSeq.iterator assert(jt.next == 4) assert(jt.drop(5).toList == List(10, 11, 12)) - + val kt = (1 until 10).toSeq.iterator assert(kt.drop(50).toList == Nil) - + val mt = (1 until 5).toSeq.iterator assert(mt.take(50).toList == List(1, 2, 3, 4)) } - + } diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala index e2d0f93a05..57e05d3472 100644 --- a/test/files/run/iterators.scala +++ b/test/files/run/iterators.scala @@ -84,16 +84,16 @@ object Test { var xs4 = a.slice(0, 4).iterator.toList; xs0.length + xs1.length + xs2.length + xs3.length + xs4.length } - + def check_toSeq: String = List(1, 2, 3, 4, 5).iterator.toSeq.mkString("x") - + def check_indexOf: String = { val i = List(1, 2, 3, 4, 5).indexOf(4) val j = List(1, 2, 3, 4, 5).indexOf(16) "" + i + "x" + j } - + def check_findIndexOf: String = { val i = List(1, 2, 3, 4, 5).indexWhere { x: Int => x >= 4 } val j = List(1, 2, 3, 4, 5).indexWhere { x: Int => x >= 16 } diff --git a/test/files/run/java-erasure.scala b/test/files/run/java-erasure.scala index 0441ad705b..c9f9b0ad51 100644 --- a/test/files/run/java-erasure.scala +++ b/test/files/run/java-erasure.scala @@ -3,7 +3,7 @@ object Test { list add "a" list add "c" list add "b" - + def main(args: Array[String]): Unit = { println(java.util.Collections.max(list)) } diff --git a/test/files/run/kind-repl-command.check b/test/files/run/kind-repl-command.check index afa32acdae..1c292572e6 100644 --- a/test/files/run/kind-repl-command.check +++ b/test/files/run/kind-repl-command.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> :kind scala.Option scala.Option's kind is F[+A] @@ -28,5 +26,3 @@ scala> :k Nonexisting ^ scala> - -scala> diff --git a/test/files/run/kmpSliceSearch.scala b/test/files/run/kmpSliceSearch.scala index 0f7e052d5f..e72f78bfed 100644 --- a/test/files/run/kmpSliceSearch.scala +++ b/test/files/run/kmpSliceSearch.scala @@ -12,7 +12,7 @@ object Test { } def main(args: Array[String]) { val rng = new scala.util.Random(java.lang.Integer.parseInt("kmp",36)) - + // Make sure we agree with naive implementation for (h <- Array(2,5,1000)) { for (i <- 0 to 100) { @@ -38,7 +38,7 @@ object Test { } } } - + // Check performance^Wcorrectness of common small test cases val haystacks = List[Seq[Int]]( Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15), @@ -52,8 +52,8 @@ object Test { List(1,1,1,1,1,2), 5 to 9 ) - (haystacks zip needles) foreach { - case (hay, nee) => + (haystacks zip needles) foreach { + case (hay, nee) => println(hay.indexOfSlice(nee,2) + " " + hay.lastIndexOfSlice(nee,13)) } } diff --git a/test/files/run/lazy-exprs.scala b/test/files/run/lazy-exprs.scala index fc724bd10b..204c4b564b 100644 --- a/test/files/run/lazy-exprs.scala +++ b/test/files/run/lazy-exprs.scala @@ -2,7 +2,7 @@ object TestExpressions { def patmatchScrut { lazy val z1: Option[String] = { println("forced <z1>"); Some("lazy z1") } - + val res = z1 match { case Some(msg) => msg case None => "failed" @@ -17,10 +17,10 @@ object TestExpressions { def patmatchCase { val t: Option[String] = Some("test") val res = t match { - case Some(msg) => + case Some(msg) => lazy val z1 = { println("forced <z1>"); "lazy z1" } z1 - + case None => "failed" } print("lazy val in case: ") @@ -36,9 +36,9 @@ object TestExpressions { print("lazy val in case: ") val t: Option[String] = Some("lazy Z1") t match { - case Some(Z1) => + case Some(Z1) => println("ok") - + case None => println("failed") } @@ -60,13 +60,13 @@ object TestExpressions { print("lazy val in pattern: ") val t: Option[String] = Some("LazyField") t match { - case Some(LazyField) => + case Some(LazyField) => println("ok") - + case None => println("failed") } - } + } lazy val (x, y) = ({print("x"); "x"}, {print("y"); "y"}) def testPatLazyVal { diff --git a/test/files/run/lazy-locals.scala b/test/files/run/lazy-locals.scala index 8d4c61be8c..b28b28e35d 100644 --- a/test/files/run/lazy-locals.scala +++ b/test/files/run/lazy-locals.scala @@ -59,7 +59,7 @@ object Test extends App { val sum3 = t00 + t01 + t02 + t03 + t04 + t05 + t06 + t07 + t08 + t09 + t10 + t11 + t12 + t13 + t14 + t15 + t16 + t17 + t18 + t19 + t20 + t21 + t22 + t23 + t24 + t25 + t26 + - t27 + t28 + t29 + t30 + t31 + t27 + t28 + t29 + t30 + t31 @@ -175,18 +175,18 @@ object Test extends App { // see #1589 object NestedLazyVals { - lazy val x = { + lazy val x = { lazy val y = { println("forcing y"); 42; } println("forcing x") - y + y } - + val x1 = 5 + { lazy val y = 10 ; y } - + println(x) println(x1) } - + trait TNestedLazyVals { lazy val x = { lazy val y = 42; y } } diff --git a/test/files/run/lazy-override-run.scala b/test/files/run/lazy-override-run.scala index d197408775..6016c3c8be 100644 --- a/test/files/run/lazy-override-run.scala +++ b/test/files/run/lazy-override-run.scala @@ -20,7 +20,7 @@ object Test extends App { val b = new B print("b.x=") - println(b.x) + println(b.x) print("b.z=") - println(b.z) + println(b.z) } diff --git a/test/files/run/lazy-traits.scala b/test/files/run/lazy-traits.scala index f04c0b8b1f..38207672db 100644 --- a/test/files/run/lazy-traits.scala +++ b/test/files/run/lazy-traits.scala @@ -1,5 +1,5 @@ trait A { - lazy val z1 = { + lazy val z1 = { println("<forced z1>") "lazy z1" } @@ -7,7 +7,7 @@ trait A { /** Simple class which mixes in one lazy val. */ class Cls extends AnyRef with A { - override def toString = + override def toString = "z1 = " + z1 } @@ -18,7 +18,7 @@ class Cls2 extends AnyRef with A { "lazy z2" } - override def toString = + override def toString = "z1 = " + z1 + " z2 = " + z2 } @@ -34,7 +34,7 @@ class ClsB extends Object with B { println("<forced zc1>") "lazy zc1" } - override def toString = + override def toString = "z1 = " + z1 + " zb1 = " + zb1 + " zc1 = " + zc1 } @@ -73,39 +73,39 @@ class OverflownLazyFields extends Object with A { lazy val zc30 = { println("<forced zc30>"); "lazy zc30" } lazy val zc31 = { println("<forced zc31>"); "lazy zc31" } - override def toString = - "\nzc00 = " + zc00 + - "\nzc01 = " + zc01 + - "\nzc02 = " + zc02 + - "\nzc03 = " + zc03 + - "\nzc04 = " + zc04 + - "\nzc05 = " + zc05 + - "\nzc06 = " + zc06 + - "\nzc07 = " + zc07 + - "\nzc08 = " + zc08 + - "\nzc09 = " + zc09 + - "\nzc10 = " + zc10 + - "\nzc11 = " + zc11 + - "\nzc12 = " + zc12 + - "\nzc13 = " + zc13 + - "\nzc14 = " + zc14 + - "\nzc15 = " + zc15 + - "\nzc16 = " + zc16 + - "\nzc17 = " + zc17 + - "\nzc18 = " + zc18 + - "\nzc19 = " + zc19 + - "\nzc20 = " + zc20 + - "\nzc21 = " + zc21 + - "\nzc22 = " + zc22 + - "\nzc23 = " + zc23 + - "\nzc24 = " + zc24 + - "\nzc25 = " + zc25 + - "\nzc26 = " + zc26 + - "\nzc27 = " + zc27 + - "\nzc28 = " + zc28 + - "\nzc29 = " + zc29 + - "\nzc30 = " + zc30 + - "\nzc31 = " + zc31 + + override def toString = + "\nzc00 = " + zc00 + + "\nzc01 = " + zc01 + + "\nzc02 = " + zc02 + + "\nzc03 = " + zc03 + + "\nzc04 = " + zc04 + + "\nzc05 = " + zc05 + + "\nzc06 = " + zc06 + + "\nzc07 = " + zc07 + + "\nzc08 = " + zc08 + + "\nzc09 = " + zc09 + + "\nzc10 = " + zc10 + + "\nzc11 = " + zc11 + + "\nzc12 = " + zc12 + + "\nzc13 = " + zc13 + + "\nzc14 = " + zc14 + + "\nzc15 = " + zc15 + + "\nzc16 = " + zc16 + + "\nzc17 = " + zc17 + + "\nzc18 = " + zc18 + + "\nzc19 = " + zc19 + + "\nzc20 = " + zc20 + + "\nzc21 = " + zc21 + + "\nzc22 = " + zc22 + + "\nzc23 = " + zc23 + + "\nzc24 = " + zc24 + + "\nzc25 = " + zc25 + + "\nzc26 = " + zc26 + + "\nzc27 = " + zc27 + + "\nzc28 = " + zc28 + + "\nzc29 = " + zc29 + + "\nzc30 = " + zc30 + + "\nzc31 = " + zc31 + "\nz1 = " + z1 } diff --git a/test/files/run/lift-and-unlift.scala b/test/files/run/lift-and-unlift.scala index a4a5d9502e..9cd85666e8 100644 --- a/test/files/run/lift-and-unlift.scala +++ b/test/files/run/lift-and-unlift.scala @@ -5,21 +5,21 @@ object Test { val evens2: PartialFunction[Int, Int] = { case x if x % 2 == 0 => x } - + def main(args: Array[String]): Unit = { val f1 = evens1 _ val f2 = evens2.lift - + assert(1 to 10 forall (x => f1(x) == f2(x))) - + val f3 = unlift(f1) val f4 = unlift(f2) - + assert(1 to 10 forall { x => if (!f3.isDefinedAt(x)) !f4.isDefinedAt(x) else f3(x) == f4(x) }) - + assert(f1 eq f3.lift) assert(f4 eq unlift(f2)) assert(f4 eq evens2) diff --git a/test/files/run/lists-run.scala b/test/files/run/lists-run.scala index 5ff3ee353e..05767b9005 100644 --- a/test/files/run/lists-run.scala +++ b/test/files/run/lists-run.scala @@ -6,7 +6,7 @@ import scala.language.postfixOps object Test { def main(args: Array[String]) { - Test_multiset.run() // multiset operations: union, intersect, diff + Test_multiset.run() // multiset operations: union, intersect, diff Test1.run() //count, exists, filter, .. Test2.run() //#468 Test3.run() //#1691 @@ -56,7 +56,7 @@ object Test_multiset { assert(List(3, 2) == (vs diff xs), "vs_diff_xs") assert(isSubListOf(xs filterNot (vs contains), xs diff vs), "xs_subset_vs") - // tests adapted from Thomas Jung + // tests adapted from Thomas Jung assert({ def sort(zs: List[Int]) = zs sortWith ( _ > _ ) sort(xs intersect ys) == sort(ys intersect xs) @@ -64,7 +64,7 @@ object Test_multiset { assert({ def cardinality[A](zs: List[A], e: A): Int = zs count (e == _) val intersection = xs intersect ys - xs forall (e => cardinality(intersection, e) == (cardinality(xs, e) + xs forall (e => cardinality(intersection, e) == (cardinality(xs, e) min cardinality(ys, e))) }, "obey min cardinality") assert({ @@ -135,7 +135,7 @@ object Test2 { def run() { val xs1 = List(1, 2, 3) val xs2 = List(0) - + val ys1 = xs1 ::: List(4) assert(List(1, 2, 3, 4) == ys1, "check_:::") diff --git a/test/files/run/lub-visibility.check b/test/files/run/lub-visibility.check index 50a0cadebf..f76579412e 100644 --- a/test/files/run/lub-visibility.check +++ b/test/files/run/lub-visibility.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> // should infer List[scala.collection.immutable.Seq[Nothing]] scala> // but reverted that for SI-5534. @@ -11,5 +9,3 @@ scala> val x = List(List(), Vector()) x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing] with java.io.Serializable] = List(List(), Vector()) scala> - -scala> diff --git a/test/files/run/macro-abort-fresh.check b/test/files/run/macro-abort-fresh.check index 75ad5e79f8..87491f6e48 100644 --- a/test/files/run/macro-abort-fresh.check +++ b/test/files/run/macro-abort-fresh.check @@ -1,6 +1,6 @@ $1$ qwe1 qwe2 -reflective compilation has failed: +reflective compilation has failed: blargh diff --git a/test/files/run/macro-def-infer-return-type.check b/test/files/run/macro-def-infer-return-type.check index 308e881960..fbd164f139 100644 --- a/test/files/run/macro-def-infer-return-type.check +++ b/test/files/run/macro-def-infer-return-type.check @@ -1,5 +1,5 @@ 42 -reflective compilation has failed: +reflective compilation has failed: exception during macro expansion: java.lang.Error: an implementation is missing diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check index 1c3ecfdefb..2709b57038 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check @@ -1,4 +1,4 @@ -reflective compilation has failed: +reflective compilation has failed: no `: _*' annotation allowed here (such annotations are only allowed in arguments to *-parameters) diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check index 916195145e..1d531f6d86 100644 --- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check @@ -1,4 +1,4 @@ -reflective compilation has failed: +reflective compilation has failed: type mismatch; found : String("42") diff --git a/test/files/run/macro-invalidret-nontypeable.check b/test/files/run/macro-invalidret-nontypeable.check index cf7acb0d60..25cef2c786 100644 --- a/test/files/run/macro-invalidret-nontypeable.check +++ b/test/files/run/macro-invalidret-nontypeable.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: not found: value IDoNotExist diff --git a/test/files/run/macro-invalidusage-badret.check b/test/files/run/macro-invalidusage-badret.check index 221732eefc..9225b716d6 100644 --- a/test/files/run/macro-invalidusage-badret.check +++ b/test/files/run/macro-invalidusage-badret.check @@ -1,4 +1,4 @@ -reflective compilation has failed: +reflective compilation has failed: type mismatch; found : Int(42) diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check index 326f3e08ca..6cbcb9e5af 100644 --- a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: too few argument lists for macro invocation diff --git a/test/files/run/macro-invalidusage-partialapplication.check b/test/files/run/macro-invalidusage-partialapplication.check index 326f3e08ca..6cbcb9e5af 100644 --- a/test/files/run/macro-invalidusage-partialapplication.check +++ b/test/files/run/macro-invalidusage-partialapplication.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: too few argument lists for macro invocation diff --git a/test/files/run/macro-reify-freevars.check b/test/files/run/macro-reify-freevars.check index f13806889e..f618e307b2 100644 --- a/test/files/run/macro-reify-freevars.check +++ b/test/files/run/macro-reify-freevars.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: Macro expansion contains free term variable code defined by map in Macros_1.scala:9:9. Have you forgotten to use splice when splicing this variable into a reifee? If you have troubles tracking free term variables, consider using -Xlog-free-terms diff --git a/test/files/run/macro-reify-tagless-a.check b/test/files/run/macro-reify-tagless-a.check index 231741edc5..d160e8043c 100644 --- a/test/files/run/macro-reify-tagless-a.check +++ b/test/files/run/macro-reify-tagless-a.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: Macro expansion contains free type variable T defined by foo in Impls_Macros_1.scala:7:13. Have you forgotten to use c.WeakTypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index 8d43a3aa16..46ea1f6405 100644 --- a/test/files/run/macro-repl-basic.check +++ b/test/files/run/macro-repl-basic.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import language.experimental.macros import language.experimental.macros diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check index 99b70ea3dc..9c35aad6b1 100644 --- a/test/files/run/macro-repl-dontexpand.check +++ b/test/files/run/macro-repl-dontexpand.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> def bar(c: scala.reflect.macros.Context) = ??? bar: (c: scala.reflect.macros.Context)Nothing diff --git a/test/files/run/macro-system-properties.check b/test/files/run/macro-system-properties.check index a2da4aaf60..ff96a34426 100644 --- a/test/files/run/macro-system-properties.check +++ b/test/files/run/macro-system-properties.check @@ -1,9 +1,7 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> import language.experimental._, reflect.macros.Context +scala> import language.experimental._, reflect.macros.Context import language.experimental._ import reflect.macros.Context @@ -22,5 +20,3 @@ scala> object Test { class C(implicit a: Any) { GrabContext.grab } } defined object Test scala> - -scala> diff --git a/test/files/run/mapConserve.scala b/test/files/run/mapConserve.scala index 330fb34ca1..d1d52f3107 100644 --- a/test/files/run/mapConserve.scala +++ b/test/files/run/mapConserve.scala @@ -7,8 +7,8 @@ import scala.collection.mutable.ListBuffer object Test { val maxListLength = 7 // up to 16, but larger is slower var testCount = 0 - - def checkStackOverflow() = { + + def checkStackOverflow() = { var xs: List[String] = Nil for (i <- 0 until 250000) xs = "X" :: xs @@ -50,7 +50,7 @@ object Test { // Behaves like existing mapConserve with respect to eq checkBehaviourUnchanged(data, data mapConserve lastHexDigit, data mapConserve lastHexDigit) } - + checkStackOverflow(); } } diff --git a/test/files/run/mapValues.scala b/test/files/run/mapValues.scala index bd1794bc51..d3266bd18f 100644 --- a/test/files/run/mapValues.scala +++ b/test/files/run/mapValues.scala @@ -1,7 +1,7 @@ object Test { val m = Map(1 -> 1, 2 -> 2) val mv = (m mapValues identity) - 1 - + def main(args: Array[String]): Unit = { assert(mv.size == 1) } diff --git a/test/files/run/map_java_conversions.scala b/test/files/run/map_java_conversions.scala index 751167c04d..c007b3e0eb 100644 --- a/test/files/run/map_java_conversions.scala +++ b/test/files/run/map_java_conversions.scala @@ -4,20 +4,20 @@ object Test { - + def main(args: Array[String]) { import collection.JavaConversions._ - + test(new java.util.HashMap[String, String]) test(new java.util.Properties) testConcMap } - + def testConcMap { import collection.JavaConversions._ - + val concMap = new java.util.concurrent.ConcurrentHashMap[String, String] - + test(concMap) val cmap = mapAsScalaConcurrentMap(concMap) cmap.putIfAbsent("absentKey", "absentValue") @@ -26,31 +26,31 @@ object Test { assert(cmap.replace("absentKey", "newAbsentValue") == Some("absentValue")) assert(cmap.replace("absentKey", "newAbsentValue", ".......") == true) } - + def test(m: collection.mutable.Map[String, String]) { m.clear assert(m.size == 0) - + m.put("key", "value") assert(m.size == 1) - + assert(m.put("key", "anotherValue") == Some("value")) assert(m.put("key2", "value2") == None) assert(m.size == 2) - + m += (("key3", "value3")) assert(m.size == 3) - + m -= "key2" assert(m.size == 2) assert(m.nonEmpty) assert(m.remove("key") == Some("anotherValue")) - + m.clear for (i <- 0 until 10) m += (("key" + i, "value" + i)) for ((k, v) <- m) assert(k.startsWith("key")) } - + } diff --git a/test/files/run/matchbytes.scala b/test/files/run/matchbytes.scala index 7190886bab..f2cea06eb3 100644 --- a/test/files/run/matchbytes.scala +++ b/test/files/run/matchbytes.scala @@ -4,4 +4,4 @@ object Test extends App{ case 1 => println(1); case _ => println("????"); } -} +} diff --git a/test/files/run/matchintasany.scala b/test/files/run/matchintasany.scala index c6764b31b9..03f6ca2a84 100644 --- a/test/files/run/matchintasany.scala +++ b/test/files/run/matchintasany.scala @@ -5,4 +5,4 @@ object Test extends App{ case 1L => println(1); case _ => println("????"); } -} +} diff --git a/test/files/run/matchnull.scala b/test/files/run/matchnull.scala index cfb3049239..2cc8550d47 100644 --- a/test/files/run/matchnull.scala +++ b/test/files/run/matchnull.scala @@ -3,7 +3,7 @@ object Test def f1 = null match { case x: AnyRef => 1 case _ => -1 } def f2(x: Any) = x match { case 52 => 1 ; case null => -1 ; case _ => 0 } def f3(x: AnyRef) = x match { case x: String => 1 ; case List(_) => 0 ; case null => -1 ; case _ => -2 } - + def main(args: Array[String]): Unit = { println(f1) println(f2(null)) diff --git a/test/files/run/misc.scala b/test/files/run/misc.scala index 139d2d70f7..2ae76bd968 100644 --- a/test/files/run/misc.scala +++ b/test/files/run/misc.scala @@ -60,7 +60,7 @@ object Test { Console.println; val x = 13; x; - // !!! why are DefDef replaced by Block(Tree[0])? we should use Empty! + // !!! why are DefDef replaced by Block(Tree[0])? we should use Empty! def f = 19; f; def f0() = 11; diff --git a/test/files/run/missingparams.scala b/test/files/run/missingparams.scala index e9b1d27d68..fbc4d2a4f7 100644 --- a/test/files/run/missingparams.scala +++ b/test/files/run/missingparams.scala @@ -6,8 +6,8 @@ final class Foo(val x: Int) { // test that the closure elimination is not wrongly replacing // 'that' by 'this' - def intersect(that: Foo) = - filter { dummy => + def intersect(that: Foo) = + filter { dummy => // x // dummy that.x > 0 } diff --git a/test/files/run/mutable-treeset.scala b/test/files/run/mutable-treeset.scala index c9918cba96..100ab39965 100644 --- a/test/files/run/mutable-treeset.scala +++ b/test/files/run/mutable-treeset.scala @@ -9,21 +9,21 @@ object Test extends App { val min = list.min val max = list.max val nonlist = ((min - 10) until (max + 20) filterNot list.contains).toList - val sublist = list filter {x => x >=(min + 1) && x < max} - val distinctSublist = sublist.distinct + val sublist = list filter {x => x >=(min + 1) && x < max} + val distinctSublist = sublist.distinct val subnonlist = min :: max :: nonlist val subsorted = distinctSublist.sorted // subsublist for a 2nd level of slicing val almostmin = sublist.min val almostmax = sublist.max - val subsublist = sublist filter {x => x >=(almostmin + 1) && x < almostmax} - val distinctSubsublist = subsublist.distinct + val subsublist = sublist filter {x => x >=(almostmin + 1) && x < almostmax} + val distinctSubsublist = subsublist.distinct val subsubnonlist = almostmin :: almostmax :: subnonlist val subsubsorted = distinctSubsublist.sorted def testSize { - def check(set : TreeSet[Int], list: List[Int]) { + def check(set : TreeSet[Int], list: List[Int]) { assert(set.size == list.size, s"$set had size ${set.size} while $list had size ${list.size}") } @@ -46,7 +46,7 @@ object Test extends App { assert(list forall set.apply, s"$set did not contain all elements of $list using apply") assert(list forall set.contains, s"$set did not contain all elements of $list using contains") assert(!(nonlist exists set.apply), s"$set had an element from $nonlist using apply") - assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains") + assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains") } val set = TreeSet(list:_*) @@ -72,11 +72,11 @@ object Test extends App { assert(builtList.size == set.size, s"$set had size ${set.size} while $builtList had size ${builtList.size}") } assert(!(nonlist exists set.apply), s"$set had an element from $nonlist using apply") - assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains") + assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains") } val set = TreeSet[Int]() - val clone = set.clone + val clone = set.clone val subset = set.clone from (min + 1) until max val subclone = subset.clone val subsubset = subset.clone from (almostmin + 1) until almostmax @@ -100,10 +100,10 @@ object Test extends App { builtList = builtList filterNot (_ == x) assert(builtList forall set.apply, s"$set did not contain all elements of $builtList using apply") assert(builtList.size == set.size, s"$set had size $set.size while $builtList had size $builtList.size") - } + } } val set = TreeSet(list:_*) - val clone = set.clone + val clone = set.clone val subset = set.clone from (min + 1) until max val subclone = subset.clone val subsubset = subset.clone from (almostmin + 1) until almostmax @@ -114,7 +114,7 @@ object Test extends App { check(subset, subsorted) check(subclone, subsorted) - + check(subsubset, subsubsorted) check(subsubclone, subsubsorted) } diff --git a/test/files/run/null-and-intersect.scala b/test/files/run/null-and-intersect.scala index 1437fa4b25..7266dabe6d 100644 --- a/test/files/run/null-and-intersect.scala +++ b/test/files/run/null-and-intersect.scala @@ -2,7 +2,7 @@ object Test { trait Immortal class Bippy extends Immutable with Immortal class Boppy extends Immutable - + def f[T](x: Traversable[T]) = x match { case _: Map[_, _] => 3 case _: Seq[_] => 2 @@ -23,10 +23,10 @@ object Test { println(f(Seq(1))) println(f(Map(1 -> 2))) println(f(null)) - + println(g(new Bippy)) println(g(null)) - + println(h(new Bippy)) println(h(new Boppy)) println(h(null)) diff --git a/test/files/run/null-hash.scala b/test/files/run/null-hash.scala index abf15e8166..9b1f28b083 100644 --- a/test/files/run/null-hash.scala +++ b/test/files/run/null-hash.scala @@ -2,7 +2,7 @@ object Test { def f1 = List(5, 10, null: String).## def f2(x: Any) = x.## def f3 = ((55, "abc", null: List[Int])).## - + def main(args: Array[String]): Unit = { f1 f2(null) diff --git a/test/files/run/number-parsing.scala b/test/files/run/number-parsing.scala index 21551a3a07..ad1481063e 100644 --- a/test/files/run/number-parsing.scala +++ b/test/files/run/number-parsing.scala @@ -2,12 +2,12 @@ object Test { def numTests() = { val MinusZero = Float.box(-0.0f) val PlusZero = Float.box(0.0f) - + assert(PlusZero match { case MinusZero => false ; case _ => true }) assert(MinusZero match { case PlusZero => false ; case _ => true }) assert((MinusZero: scala.Float) == (PlusZero: scala.Float)) assert(!(MinusZero equals PlusZero)) - + List( -5f.max(2) , -5f max 2 , diff --git a/test/files/run/numbereq.scala b/test/files/run/numbereq.scala index a1f11da205..d50db6d049 100644 --- a/test/files/run/numbereq.scala +++ b/test/files/run/numbereq.scala @@ -13,13 +13,13 @@ object Test { if (x >= Byte.MinValue && x <= Byte.MaxValue) List(new java.lang.Byte(x.toByte)) else Nil, if (x >= Char.MinValue && x <= Char.MaxValue) List(new java.lang.Character(x.toChar)) else Nil ).flatten - + base ::: extras } def mkNumbers(x: BigInt): List[AnyRef] = { List( - List(BigDecimal(x, java.math.MathContext.UNLIMITED)), + List(BigDecimal(x, java.math.MathContext.UNLIMITED)), List(x), if (x.isValidDouble) List(new java.lang.Double(x.toDouble)) else Nil, if (x.isValidFloat) List(new java.lang.Float(x.toFloat)) else Nil, @@ -30,21 +30,21 @@ object Test { if (x.isValidChar) List(new java.lang.Character(x.toChar)) else Nil ).flatten } - + def main(args: Array[String]): Unit = { val ints = (0 to 15).toList map (Short.MinValue >> _) val ints2 = ints map (x => -x) val ints3 = ints map (_ + 1) val ints4 = ints2 map (_ - 1) - + val setneg1 = ints map mkNumbers val setneg2 = ints3 map mkNumbers val setpos1 = ints2 map mkNumbers val setpos2 = ints4 map mkNumbers val zero = mkNumbers(0) - - val sets = setneg1 ++ setneg2 ++ List(zero) ++ setpos1 ++ setpos2 - + + val sets = setneg1 ++ setneg2 ++ List(zero) ++ setpos1 ++ setpos2 + for (set <- sets ; x <- set ; y <- set) { // println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##)) assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass)) @@ -55,14 +55,14 @@ object Test { val bigInts2 = bigInts map (x => -x) val bigInts3 = bigInts map (_ + 1) val bigInts4 = bigInts2 map (_ - 1) - + val setneg1b = bigInts map mkNumbers val setneg2b = bigInts3 map mkNumbers val setpos1b = bigInts2 map mkNumbers val setpos2b = bigInts4 map mkNumbers val sets2 = setneg1 ++ setneg1b ++ setneg2 ++ setneg2b ++ List(zero) ++ setpos1 ++ setpos1b ++ setpos2 ++ setpos2b - + for (set <- sets2 ; x <- set ; y <- set) { // println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##)) assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass)) diff --git a/test/files/run/option-fold.scala b/test/files/run/option-fold.scala index 7e21403c2e..84e346ec79 100644 --- a/test/files/run/option-fold.scala +++ b/test/files/run/option-fold.scala @@ -2,7 +2,7 @@ object Test { sealed class A case object B extends A case class C(x: Int) extends A - + def f[T](x: Option[T]) = x.fold(List.empty[T])(List(_)) def g(x: Option[A]) = x.fold(-1) { case B => 0 diff --git a/test/files/run/origins.scala b/test/files/run/origins.scala index 0ad92297f5..6529351d3c 100644 --- a/test/files/run/origins.scala +++ b/test/files/run/origins.scala @@ -14,7 +14,7 @@ object Test { def f1() = 1 to 5 map boop def f2() = 1 to 10 map boop def f3() = 1 to 50 map boop - + def main(args: Array[String]): Unit = { f1() ; f2() ; f3() } diff --git a/test/files/run/parmap-ops.scala b/test/files/run/parmap-ops.scala index f93bd7b77e..4274460c9d 100644 --- a/test/files/run/parmap-ops.scala +++ b/test/files/run/parmap-ops.scala @@ -1,10 +1,10 @@ import collection._ object Test { - + def main(args: Array[String]) { val gm: GenMap[Int, Int] = GenMap(0 -> 0, 1 -> 1).par - + // ops assert(gm.isDefinedAt(1)) assert(gm.contains(1)) @@ -21,11 +21,11 @@ object Test { } catch { case e: NoSuchElementException => // ok } - + assert(gm.filterKeys(_ % 2 == 0)(0) == 0) assert(gm.filterKeys(_ % 2 == 0).get(1) == None) assert(gm.mapValues(_ + 1)(0) == 1) - + // with defaults val pm = parallel.mutable.ParMap(0 -> 0, 1 -> 1) val dm = pm.withDefault(x => -x) @@ -37,12 +37,12 @@ object Test { assert(dm(3) == 3) assert(pm(3) == 3) assert(dm(4) == -4) - + val imdm = parallel.immutable.ParMap(0 -> 0, 1 -> 1).withDefault(x => -x) assert(imdm(0) == 0) assert(imdm(1) == 1) assert(imdm(2) == -2) assert(imdm.updated(2, 2) == parallel.ParMap(0 -> 0, 1 -> 1, 2 -> 2)) } - + } diff --git a/test/files/run/patch-boundary.scala b/test/files/run/patch-boundary.scala index 8381956859..ed1a0e9fc1 100644 --- a/test/files/run/patch-boundary.scala +++ b/test/files/run/patch-boundary.scala @@ -1,8 +1,8 @@ object Test { def f = collection.mutable.ArrayBuffer(1, 2, 3, 4, 5, 6, 7, 8) def g = f.patch(4, List(1, 2), 10) - + def main(args: Array[String]): Unit = { - assert(g.size == 6) + assert(g.size == 6) } } diff --git a/test/files/run/patmat-exprs.scala b/test/files/run/patmat-exprs.scala index 56e4e01598..7ca5fd3063 100644 --- a/test/files/run/patmat-exprs.scala +++ b/test/files/run/patmat-exprs.scala @@ -39,7 +39,7 @@ trait Pattern { // // type Numeric[T] // import java.io.Serializable - // + // // implicit def compat27a[T](x: Iterable[T]) = new { // def iterator: Iterator[T] = x.elements // def sum: Int = 5 @@ -280,8 +280,8 @@ trait Pattern { case Mul(Mul(y, Const(z)), Const(x)) => Mul(const(num.mul(x, z)), y) case Const(x) if x == num.one => One[T] - case Const(x) if x == num.zero => Zero[T] - + case Const(x) if x == num.zero => Zero[T] + case Sub(x, Neg(y)) => Add(List(x, y)) case Sub(Neg(x), y) => Neg(Add(List(x, y))) case Neg(Neg(x)) => x diff --git a/test/files/run/patmat-finally.scala b/test/files/run/patmat-finally.scala index 6f769b30a0..dfea5ad176 100644 --- a/test/files/run/patmat-finally.scala +++ b/test/files/run/patmat-finally.scala @@ -21,5 +21,5 @@ object Test extends App { } bar(null, null) - x + x } diff --git a/test/files/run/patmat-seqs.scala b/test/files/run/patmat-seqs.scala index e23711697c..b5c47b4b4b 100644 --- a/test/files/run/patmat-seqs.scala +++ b/test/files/run/patmat-seqs.scala @@ -7,14 +7,14 @@ object Test { case Seq(_, _, _, _, _, x: String) => "ss6" case _ => "d" } - + def f2(x: Any) = x match { case Seq("a", "b", _*) => "s2" case Seq(1, _*) => "s1" case Seq(5, 6, 7, _*) => "s3" case _ => "d" } - + def main(args: Array[String]): Unit = { val xs1 = List( List(1,2,3), @@ -24,9 +24,9 @@ object Test { Seq(1, 2, 3, 4, 5, "abcd"), "abc" ) map f1 - + xs1 foreach println - + val xs2 = List( Seq(5, 6, 7), Seq(5, 6, 7, 8, 9), @@ -36,7 +36,7 @@ object Test { Nil, 5 ) map f2 - + xs2 foreach println } } diff --git a/test/files/run/patmat_unapp_abstype-new.check b/test/files/run/patmat_unapp_abstype-new.check index c5511e9516..35447dbbfa 100644 --- a/test/files/run/patmat_unapp_abstype-new.check +++ b/test/files/run/patmat_unapp_abstype-new.check @@ -1,5 +1,5 @@ patmat_unapp_abstype-new.scala:21: warning: abstract type pattern TypesUser.this.TypeRef is unchecked since it is eliminated by erasure - case TypeRef(x) => println("TypeRef") + case TypeRef(x) => println("TypeRef") ^ patmat_unapp_abstype-new.scala:53: warning: abstract type pattern Intermed.this.Foo is unchecked since it is eliminated by erasure case Foo(x) => println("Foo") diff --git a/test/files/run/patmat_unapp_abstype-new.scala b/test/files/run/patmat_unapp_abstype-new.scala index 1141177504..c2927bd124 100644 --- a/test/files/run/patmat_unapp_abstype-new.scala +++ b/test/files/run/patmat_unapp_abstype-new.scala @@ -18,7 +18,7 @@ trait TypesAPI { trait TypesUser extends TypesAPI { def shouldNotCrash(tp: Type): Unit = { tp match { - case TypeRef(x) => println("TypeRef") + case TypeRef(x) => println("TypeRef") case MethodType(x) => println("MethodType") case _ => println("none of the above") } @@ -27,7 +27,7 @@ trait TypesUser extends TypesAPI { trait TypesImpl extends TypesAPI { object TypeRef extends TypeRefExtractor // this will have a bridged unapply(x: Type) = unapply(x.asInstanceOf[TypeRef]) - case class TypeRef(n: Int) extends Type // this has a bridge from TypesAPI#Type to TypesImpl#TypeRef + case class TypeRef(n: Int) extends Type // this has a bridge from TypesAPI#Type to TypesImpl#TypeRef // --> the cast in the bridge will fail because the pattern matcher can't type test against the abstract types in TypesUser } diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala index fb49e0c924..35b733d080 100644 --- a/test/files/run/patmatnew.scala +++ b/test/files/run/patmatnew.scala @@ -254,7 +254,7 @@ object Test { } // (not regular) fancy guards / bug#644 - object TestSequence06 { + object TestSequence06 { case class A(i: Any) @@ -450,7 +450,7 @@ object Test { object Get extends Sync var ps: PartialFunction[Any, Any] = { - case Get(y) if y > 4 => // y gets a wildcard type for some reason?! hack + case Get(y) if y > 4 => // y gets a wildcard type for some reason?! hack } } def run() { diff --git a/test/files/run/pc-conversions.scala b/test/files/run/pc-conversions.scala index b1ef3d963e..19fef355c8 100644 --- a/test/files/run/pc-conversions.scala +++ b/test/files/run/pc-conversions.scala @@ -7,11 +7,11 @@ import collection._ // test conversions between collections object Test { - + def main(args: Array[String]) { testConversions } - + def testConversions { // seq conversions assertSeq(parallel.mutable.ParArray(1, 2, 3)) @@ -20,7 +20,7 @@ object Test { assertSeq(parallel.immutable.ParRange(1, 50, 1, false)) assertSeq(parallel.immutable.ParHashMap(1 -> 2, 2 -> 4)) assertSeq(parallel.immutable.ParHashSet(1, 2, 3)) - + // par conversions assertPar(Array(1, 2, 3)) assertPar(mutable.ArrayBuffer(1, 2, 3)) @@ -31,7 +31,7 @@ object Test { assertPar(immutable.Range(1, 50, 1)) assertPar(immutable.HashMap(1 -> 1, 2 -> 2)) assertPar(immutable.HashSet(1, 2, 3)) - + // par.to* and to*.par tests assertToPar(List(1 -> 1, 2 -> 2, 3 -> 3)) assertToPar(Stream(1 -> 1, 2 -> 2)) @@ -49,19 +49,19 @@ object Test { assertToPar(parallel.mutable.ParHashSet(1 -> 2)) assertToPar(parallel.immutable.ParHashMap(1 -> 2)) assertToPar(parallel.immutable.ParHashSet(1 -> 3)) - + assertToParWoMap(immutable.Range(1, 10, 2)) - + // seq and par again conversions) assertSeqPar(parallel.mutable.ParArray(1, 2, 3)) } - + def assertSeqPar[T](pc: parallel.ParIterable[T]) = pc.seq.par == pc - + def assertSeq[T](pc: parallel.ParIterable[T]) = assert(pc.seq == pc) - + def assertPar[T, P <: Parallel](xs: GenIterable[T]) = assert(xs == xs.par) - + def assertToPar[K, V](xs: GenTraversable[(K, V)]) { xs match { case _: Seq[_] => @@ -69,26 +69,26 @@ object Test { assert(xs.par.toIterable == xs) case _ => } - + assert(xs.toSeq.par == xs.toSeq) assert(xs.par.toSeq == xs.toSeq) - + assert(xs.toSet.par == xs.toSet) assert(xs.par.toSet == xs.toSet) - + assert(xs.toMap.par == xs.toMap) assert(xs.par.toMap == xs.toMap) } - + def assertToParWoMap[T](xs: GenSeq[T]) { assert(xs.toIterable.par == xs.toIterable) assert(xs.par.toIterable == xs.toIterable) - + assert(xs.toSeq.par == xs.toSeq) assert(xs.par.toSeq == xs.toSeq) - + assert(xs.toSet.par == xs.toSet) assert(xs.par.toSet == xs.toSet) } - + } diff --git a/test/files/run/pf-catch.scala b/test/files/run/pf-catch.scala index dfe43dc750..33982d0557 100644 --- a/test/files/run/pf-catch.scala +++ b/test/files/run/pf-catch.scala @@ -8,12 +8,12 @@ object Test { case x: java.util.NoSuchElementException => shortName(x) case x: java.lang.IllegalArgumentException => shortName(x) } - + def fn[T: Handler](body: => T): T = { try body catch implicitly[Handler[T]] } - + def f1 = { implicit val myHandler = standardHandler println(fn(Nil.head)) @@ -30,7 +30,7 @@ object Test { def main(args: Array[String]): Unit = { try f1 catch { case x: Throwable => println(shortName(x) + " slipped by.") } - + f2 } } diff --git a/test/files/run/primitive-sigs-2-old.scala b/test/files/run/primitive-sigs-2-old.scala index 0a4be93f22..16fe5ae555 100644 --- a/test/files/run/primitive-sigs-2-old.scala +++ b/test/files/run/primitive-sigs-2-old.scala @@ -27,7 +27,7 @@ object Test { val c1: Class[_] = classOf[T[_]] val c2: Class[_] = classOf[C] val c3: Class[_] = classOf[Arr] - + val c1m = c1.getMethods.toList filter (_.getName == "f") map (_.getGenericReturnType.toString) val c2m = c2.getMethods.toList filter (_.getName == "f") map (_.getGenericReturnType.toString) val c3m = c3.getDeclaredMethods.toList map (_.toGenericString) diff --git a/test/files/run/priorityQueue.scala b/test/files/run/priorityQueue.scala index edc0e32b02..327d8bf137 100644 --- a/test/files/run/priorityQueue.scala +++ b/test/files/run/priorityQueue.scala @@ -31,23 +31,23 @@ object Test { // val pq2 = new PriorityQueue[String] // val pq3 = new PriorityQueue[String] // val pq4 = new PriorityQueue[String] - + // val strings = (1 to 20).toList map (i => List.fill((Math.abs(nextInt % 20)) + 1)("x").mkString) - + // pq1 ++= strings // pq2 ++= strings.reverse // for (s <- strings) pq3 += s // for (s <- strings.reverse) pq4 += s - + // val pqs = List(pq1, pq2, pq3, pq4, pq1.clone, pq2.clone) - + // for (queue1 <- pqs ; queue2 <- pqs) { // val l1: List[String] = queue1.dequeueAll[String, List[String]] // val l2: List[String] = queue2.dequeueAll[String, List[String]] // assert(l1 == l2) // assert(queue1.max == queue2.max) // } - + // assertPriorityDestructive(pq1) // } @@ -83,7 +83,7 @@ object Test { // } // for (i <- 0 until 100) assert(intpq(i) == (99 - i)) // } - + // def testTails { // val pq = new PriorityQueue[Int] // for (i <- 0 until 10) pq += i * 4321 % 200 @@ -108,13 +108,13 @@ object Test { // prev = curr // } // } - + // def testInits { // val pq = new PriorityQueue[Long] // for (i <- 0 until 20) pq += (i + 313) * 111 % 300 - + // assert(pq.size == 20) - + // val initpq = pq.init // assert(initpq.size == 19) // assertPriorityDestructive(initpq) @@ -123,19 +123,19 @@ object Test { // def testFilters { // val pq = new PriorityQueue[String] // for (i <- 0 until 100) pq += "Some " + (i * 312 % 200) - + // val filpq = pq.filter(_.indexOf('0') != -1) // assertPriorityDestructive(filpq) // } // def testIntensiveEnqueueDequeue { // val pq = new PriorityQueue[Int] - + // testIntensive(1000, pq) // pq.clear // testIntensive(200, pq) // } - + // def testIntensive(sz: Int, pq: PriorityQueue[Int]) { // val lst = new collection.mutable.ArrayBuffer[Int] ++ (0 until sz) // val rand = new util.Random(7) @@ -153,7 +153,7 @@ object Test { // pq ++= (0 until 100) // val droppq = pq.drop(50) // assertPriority(droppq) - + // pq.clear // pq ++= droppq // assertPriorityDestructive(droppq) @@ -173,7 +173,7 @@ object Test { // // assertPriority(pq) // // pq.clear - + // // pq ++= (1 to 100) // // pq(5) = 200 // // assert(pq(0) == 200) @@ -204,7 +204,7 @@ object Test { // def testEquality { // val pq1 = new PriorityQueue[Int] // val pq2 = new PriorityQueue[Int] - + // pq1 ++= (0 until 50) // var i = 49 // while (i >= 0) { @@ -213,7 +213,7 @@ object Test { // } // assert(pq1 == pq2) // assertPriority(pq2) - + // pq1 += 100 // assert(pq1 != pq2) // pq2 += 100 @@ -230,7 +230,7 @@ object Test { // val pq = new PriorityQueue[Int] // pq ++= (0 until 100) // assert(pq.size == 100) - + // val (p1, p2) = pq.partition(_ < 50) // assertPriorityDestructive(p1) // assertPriorityDestructive(p2) @@ -252,13 +252,13 @@ object Test { // assert(pq.lastIndexWhere(_ == 9) == 0) // assert(pq.lastIndexOf(8) == 1) // assert(pq.lastIndexOf(7) == 2) - + // pq += 5 // pq += 9 // assert(pq.lastIndexOf(9) == 1) // assert(pq.lastIndexWhere(_ % 2 == 1) == 10) // assert(pq.lastIndexOf(5) == 6) - + // val lst = pq.reverseIterator.toList // for (i <- 0 until 5) assert(lst(i) == i) // assert(lst(5) == 5) @@ -268,13 +268,13 @@ object Test { // assert(lst(9) == 8) // assert(lst(10) == 9) // assert(lst(11) == 9) - + // pq.clear // assert(pq.reverseIterator.toList.isEmpty) - + // pq ++= (50 to 75) // assert(pq.lastIndexOf(70) == 5) - + // pq += 55 // pq += 70 // assert(pq.lastIndexOf(70) == 6) @@ -284,11 +284,11 @@ object Test { // assert(pq.lastIndexWhere(_ > 54, 21) == 21) // assert(pq.lastIndexWhere(_ > 69, 5) == 5) // } - + // def testReverse { // val pq = new PriorityQueue[(Int, Int)] // pq ++= (for (i <- 0 until 10) yield (i, i * i % 10)) - + // assert(pq.reverse.size == pq.reverseIterator.toList.size) // assert((pq.reverse zip pq.reverseIterator.toList).forall(p => p._1 == p._2)) // assert(pq.reverse.sameElements(pq.reverseIterator.toSeq)) @@ -296,19 +296,19 @@ object Test { // assert(pq.reverse(1)._1 == pq(8)._1) // assert(pq.reverse(4)._1 == pq(5)._1) // assert(pq.reverse(9)._1 == pq(0)._1) - + // pq += ((7, 7)) // pq += ((7, 9)) // pq += ((7, 8)) // assert(pq.reverse.reverse == pq) // assert(pq.reverse.lastIndexWhere(_._2 == 6) == 6) // assertPriorityDestructive(pq.reverse.reverse) - + // val iq = new PriorityQueue[Int] // iq ++= (0 until 50) // assert(iq.reverse == iq.reverseIterator.toSeq) // assert(iq.reverse.reverse == iq) - + // iq += 25 // iq += 40 // iq += 10 @@ -317,10 +317,10 @@ object Test { // assert(iq.reverse.lastIndexWhere(_ == 10) == 11) // assertPriorityDestructive(iq.reverse.reverse) // } - + // def testToList { // val pq = new PriorityQueue[Int] - + // pq += 1 // pq += 4 // pq += 0 @@ -330,16 +330,16 @@ object Test { // assert(pq.toList == pq) // assert(pq == List(5, 4, 3, 2, 1, 0)) // assert(pq.reverse == List(0, 1, 2, 3, 4, 5)) - + // pq.clear // for (i <- -50 until 50) pq += i // assert(pq.toList == pq) // assert(pq.toList == (-50 until 50).reverse) // } - + // def testForeach { // val pq = new PriorityQueue[Char] - + // pq += 't' // pq += 'o' // pq += 'b' @@ -351,7 +351,7 @@ object Test { // assert(sbf.toString == sbi.toString) // assert(sbf.toString == "ytob") // } - + } diff --git a/test/files/run/private-inline.check b/test/files/run/private-inline.check index eee7f2973b..3e44989521 100644 --- a/test/files/run/private-inline.check +++ b/test/files/run/private-inline.check @@ -2,6 +2,6 @@ private-inline.scala:24: warning: Could not inline required method wrapper1 beca def f1b() = identity(wrapper1(5)) ^ private-inline.scala:29: warning: Could not inline required method wrapper2 because callee contains exception handlers / finally clause, and is invoked with non-empty operand stack. - def f2b() = identity(wrapper2(5)) + def f2b() = identity(wrapper2(5)) ^ 20 diff --git a/test/files/run/private-inline.scala b/test/files/run/private-inline.scala index 72cabaeff0..60fef9efca 100644 --- a/test/files/run/private-inline.scala +++ b/test/files/run/private-inline.scala @@ -2,7 +2,7 @@ final class A { private var x1 = false var x2 = false - + // manipulates private var @inline private def wrapper1[T](body: => T): T = { val saved = x1 @@ -17,35 +17,35 @@ final class A { try body finally x2 = saved } - + // not inlined def f1a() = wrapper1(5) // inlined! def f1b() = identity(wrapper1(5)) - + // not inlined def f2a() = wrapper2(5) // inlined! - def f2b() = identity(wrapper2(5)) + def f2b() = identity(wrapper2(5)) } object Test { def methodClasses = List("f1a", "f2a") map ("A$$anonfun$" + _ + "$1") - + def main(args: Array[String]): Unit = { val a = new A import a._ println(f1a() + f1b() + f2a() + f2b()) - + // Don't know how else to test this: all these should have been // inlined, so all should fail. methodClasses foreach { clazz => - + val foundClass = ( try Class.forName(clazz) catch { case _: Throwable => null } ) - + assert(foundClass == null, foundClass) } } diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check index a6e53fbe92..10d2ed5af7 100644 --- a/test/files/run/programmatic-main.check +++ b/test/files/run/programmatic-main.check @@ -24,4 +24,3 @@ superaccessors 6 add super accessors in traits and nested classes icode 22 generate portable intermediate code jvm 23 generate JVM bytecode terminal 24 the last phase during a compilation run - diff --git a/test/files/run/programmatic-main.scala b/test/files/run/programmatic-main.scala index 08335ca6f6..542ac2781e 100644 --- a/test/files/run/programmatic-main.scala +++ b/test/files/run/programmatic-main.scala @@ -7,7 +7,7 @@ object Test { val cwd = Option(System.getProperty("partest.cwd")) getOrElse "." val basedir = Path(cwd).parent / "lib" path val baseargs = Array("-usejavacp", "-bootclasspath", basedir + "/scala-library.jar", "-cp", basedir + "/scala-compiler.jar") - + def main(args: Array[String]): Unit = { Console.withErr(Console.out) { Main process (baseargs ++ "-Xpluginsdir /does/not/exist/foo/quux -Xshow-phases".split(' ')) diff --git a/test/files/run/proxy.scala b/test/files/run/proxy.scala index ea222cb496..8a6385dc85 100644 --- a/test/files/run/proxy.scala +++ b/test/files/run/proxy.scala @@ -1,16 +1,16 @@ object Test extends App { val p = new Proxy { - def self = 2 + def self = 2 } println(p equals 1) println(p equals 2) println(p equals 3) println(p equals null) - + case class Bippy(a: String) extends Proxy { def self = a } - + val label = Bippy("bippy!") println(label == label) println(label == "bippy!") diff --git a/test/files/run/range-unit.scala b/test/files/run/range-unit.scala index ece0d9806c..d8ebc00e9c 100644 --- a/test/files/run/range-unit.scala +++ b/test/files/run/range-unit.scala @@ -6,14 +6,14 @@ object Test { ( (-3 to 3) ++ List(17, 127, Int.MaxValue, Int.MinValue + 1) ).distinct.sortBy(n => (math.abs(n), n)) ) :+ Int.MinValue - + // reducing output a little val endpoints = numbers filterNot Set(-3, -2, 2, 17, 127) - + def num(n: Int) = { val frommax = Int.MaxValue - n val frommin = Int.MinValue - n - + if (n > 0) { if (frommax == 0) "MAX" else if (frommax < 1000) "MAX-" + frommax @@ -25,7 +25,7 @@ object Test { else "" + n } } - + def run[T](body: => Range): List[Any] = { try { val r = body ; if (r.isEmpty) List(r.length) else List(num(r.length), num(r.head), num(r.last)) } catch { case e: IllegalArgumentException => List("---\n " + e) } diff --git a/test/files/run/range.scala b/test/files/run/range.scala index b81e67921a..4637ab874d 100644 --- a/test/files/run/range.scala +++ b/test/files/run/range.scala @@ -6,7 +6,7 @@ object Test { range.foreach(buffer += _); assert(buffer.toList == range.iterator.toList, buffer.toList+"/"+range.iterator.toList) } - + def boundaryTests() = { // #4321 assert((Int.MinValue to Int.MaxValue by Int.MaxValue).size == 3) @@ -28,31 +28,31 @@ object Test { ) assert(noElemAtMax) } - + case class GR[T](val x: T)(implicit val num: Integral[T]) { import num._ - + def negated = GR[T](-x) - + def gr1 = NumericRange(x, x, x) def gr2 = NumericRange.inclusive(x, x, x) def gr3 = NumericRange(x, x * fromInt(10), x) def gr4 = NumericRange.inclusive(x, x * fromInt(10), x) def gr5 = gr3.toList ::: negated.gr3.toList - + def check = { assert(gr1.isEmpty && !gr2.isEmpty) - assert(gr3.size == 9 && gr4.size == 10) + assert(gr3.size == 9 && gr4.size == 10) assert(gr5.sum == num.zero, gr5.toString) assert(!(gr3 contains (x * fromInt(10)))) assert((gr4 contains (x * fromInt(10)))) } } - + def main(args: Array[String]): Unit = { implicit val imp1 = Numeric.BigDecimalAsIfIntegral implicit val imp2 = Numeric.DoubleAsIfIntegral - + val _grs = List[GR[_]]( GR(BigDecimal(5.0)), GR(BigInt(5)), @@ -62,21 +62,21 @@ object Test { ) val grs = _grs ::: (_grs map (_.negated)) grs foreach (_.check) - + assert(NumericRange(1, 10, 1) sameElements (1 until 10)) assert(NumericRange.inclusive(1, 10, 1) sameElements (1 to 10)) assert(NumericRange.inclusive(1, 100, 3) sameElements (1 to 100 by 3)) - + // #2518 assert((3L to 7 by 2) sameElements List(3L, 5L, 7L)) - + rangeForeach(1 to 10); rangeForeach(1 until 10); rangeForeach(10 to 1 by -1); rangeForeach(10 until 1 by -1); rangeForeach(10 to 1 by -3); rangeForeach(10 until 1 by -3); - + // living on the edges boundaryTests() } diff --git a/test/files/run/records.scala b/test/files/run/records.scala index bae0d943ff..f2b582b950 100644 --- a/test/files/run/records.scala +++ b/test/files/run/records.scala @@ -19,10 +19,10 @@ object Test { val y = new C { def f = 2 def g = " world" - } - + } + val z: T = y - + def main(args: Array[String]): Unit = { assert(x.f+z.f == 3) assert(x.g+z.g == "hello world") diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check index b3b66f48d6..3af3ad774d 100644 --- a/test/files/run/reflection-equality.check +++ b/test/files/run/reflection-equality.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class X { def methodIntIntInt(x: Int, y: Int) = x+y } @@ -23,7 +21,7 @@ scala> val cs: ClassSymbol = im.symbol cs: reflect.runtime.universe.ClassSymbol = class X scala> val ts: Type = cs.typeSignature -ts: reflect.runtime.universe.Type = +ts: reflect.runtime.universe.Type = scala.AnyRef { def <init>(): X def methodIntIntInt(x: scala.Int,y: scala.Int): scala.Int diff --git a/test/files/run/reflection-magicsymbols-repl.check b/test/files/run/reflection-magicsymbols-repl.check index bb8bdc9dd9..46c21dfa00 100644 --- a/test/files/run/reflection-magicsymbols-repl.check +++ b/test/files/run/reflection-magicsymbols-repl.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/reflection-repl-classes.check b/test/files/run/reflection-repl-classes.check index d70db59b85..874fed2d7c 100644 --- a/test/files/run/reflection-repl-classes.check +++ b/test/files/run/reflection-repl-classes.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class A defined class A diff --git a/test/files/run/reflection-repl-elementary.check b/test/files/run/reflection-repl-elementary.check index d9133f7e3e..4a223e8a24 100644 --- a/test/files/run/reflection-repl-elementary.check +++ b/test/files/run/reflection-repl-elementary.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> scala.reflect.runtime.universe.typeOf[List[Nothing]] res0: reflect.runtime.universe.Type = scala.List[Nothing] diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check index 18cfd5a7ef..29ccee3cc6 100644 --- a/test/files/run/reify-repl-fail-gracefully.check +++ b/test/files/run/reify-repl-fail-gracefully.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import language.experimental.macros import language.experimental.macros @@ -17,5 +15,3 @@ scala> reify ^ scala> - -scala> diff --git a/test/files/run/reify_closure8b.check b/test/files/run/reify_closure8b.check index 5a7863ff15..5d48d3ab36 100644 --- a/test/files/run/reify_closure8b.check +++ b/test/files/run/reify_closure8b.check @@ -1,3 +1,3 @@ -scala.tools.reflect.ToolBoxError: reflective compilation has failed: +scala.tools.reflect.ToolBoxError: reflective compilation has failed: value y is not a member of Test.Foo diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check index e68fe2f6b1..1432d10127 100644 --- a/test/files/run/reify_newimpl_22.check +++ b/test/files/run/reify_newimpl_22.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ @@ -25,5 +23,3 @@ scala> { 2 scala> - -scala> diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check index 38c95646a8..217f0a98c7 100644 --- a/test/files/run/reify_newimpl_23.check +++ b/test/files/run/reify_newimpl_23.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ @@ -24,5 +22,3 @@ scala> def foo[T]{ foo: [T]=> Unit scala> - -scala> diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index 86f6abce02..93ad69defa 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> { import scala.reflect.runtime.universe._ val x = "2" @@ -15,5 +13,3 @@ scala> { TypeTag[x.type] scala> - -scala> diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index d3e2540de0..8e0ad87bf2 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> def foo[T]{ import scala.reflect.runtime.universe._ val tt = implicitly[WeakTypeTag[List[T]]] @@ -17,5 +15,3 @@ scala> foo[Int] WeakTypeTag[scala.List[T]] scala> - -scala> diff --git a/test/files/run/reify_newimpl_35.check b/test/files/run/reify_newimpl_35.check index 52aaa171e0..f884d2c0d0 100644 --- a/test/files/run/reify_newimpl_35.check +++ b/test/files/run/reify_newimpl_35.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ @@ -13,5 +11,3 @@ scala> println(foo) Expr[List[Nothing]](Nil) scala> - -scala> diff --git a/test/files/run/repl-assign.check b/test/files/run/repl-assign.check index c6b0458f04..bdc7793c37 100644 --- a/test/files/run/repl-assign.check +++ b/test/files/run/repl-assign.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> var x = 10 x: Int = 10 @@ -16,5 +14,3 @@ scala> y = 13 y: Int = 13 scala> - -scala> diff --git a/test/files/run/repl-bare-expr.check b/test/files/run/repl-bare-expr.check index a92243c7c0..97ae208ff4 100644 --- a/test/files/run/repl-bare-expr.check +++ b/test/files/run/repl-bare-expr.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> 2 ; 3 <console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses 2 ;; @@ -50,5 +48,3 @@ scala> Bovine.x res4: List[Any] = List(Ruminant(5), Cow, Moooooo) scala> - -scala> diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check index 002316fd54..1f6d3e2b39 100644 --- a/test/files/run/repl-colon-type.check +++ b/test/files/run/repl-colon-type.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> :type List[1, 2, 3] <console>:1: error: identifier expected but integer literal found. List[1, 2, 3] @@ -40,7 +38,7 @@ Int scala> :type protected lazy val f = 5 <console>:5: error: lazy value f cannot be accessed in object $iw Access to protected value f not permitted because - enclosing object $eval in package $line13 is not a subclass of + enclosing object $eval in package $line13 is not a subclass of object $iw where target is defined lazy val $result = f ^ @@ -80,7 +78,7 @@ TypeRef( TypeRef( TypeSymbol( sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable - + ) args = List( TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) @@ -101,7 +99,7 @@ PolyType( resultType = TypeRef( TypeSymbol( abstract trait Set[A] extends Iterable[A] with Set[A] with GenericSetTemplate[A,scala.collection.immutable.Set] with SetLike[A,scala.collection.immutable.Set[A]] with Parallelizable[A,scala.collection.parallel.immutable.ParSet[A]] - + ) args = List(TypeRef(TypeSymbol(abstract class Any extends ))) ) @@ -147,7 +145,7 @@ TypeRef( TypeRef( TypeSymbol( sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable - + ) args = List( TypeRef( @@ -180,7 +178,7 @@ PolyType( TypeRef( TypeSymbol( sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable - + ) args = List(TypeParamTypeRef(TypeParam(T <: AnyVal))) ) @@ -203,7 +201,7 @@ PolyType( resultType = TypeRef( TypeSymbol( sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable - + ) args = List(TypeParamTypeRef(TypeParam(U >: T))) ) @@ -221,5 +219,3 @@ scala> :type println("side effect!") Unit scala> - -scala> diff --git a/test/files/run/repl-out-dir.check b/test/files/run/repl-out-dir.check index a96f9ba9d9..3e51c63155 100644 --- a/test/files/run/repl-out-dir.check +++ b/test/files/run/repl-out-dir.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> case class Bippy(x: Int) defined class Bippy @@ -49,5 +47,3 @@ repl-out-dir-run.obj Test.class scala> - -scala> diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check index 203b020f2c..ab3809a2e0 100644 --- a/test/files/run/repl-paste-2.check +++ b/test/files/run/repl-paste-2.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> scala> 999l // Detected repl transcript paste: ctrl-D to finish. @@ -31,7 +29,6 @@ res9: Int = 6 scala> x.length + res5 res10: Int = 12 - // Replaying 8 commands from transcript. scala> 999l diff --git a/test/files/run/repl-paste-3.check b/test/files/run/repl-paste-3.check index 2b4c941c33..8fae61792e 100644 --- a/test/files/run/repl-paste-3.check +++ b/test/files/run/repl-paste-3.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> println(3) 3 @@ -10,5 +8,3 @@ scala> List(1,2) res1: List[Int] = List(1, 2) scala> - -scala> diff --git a/test/files/run/repl-paste.check b/test/files/run/repl-paste.check index e4c407c6e8..97f177ddc4 100644 --- a/test/files/run/repl-paste.check +++ b/test/files/run/repl-paste.check @@ -17,7 +17,6 @@ object Dingus val x = (new Dingus).y - // Exiting paste mode, now interpreting. defined class Dingus diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index 1abb8e9d14..d6a0d8c931 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -21,7 +21,7 @@ scala> tp.memberType(Array_apply) // evidence res1: $r.global.Type = (i: Int)scala.util.Random scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl -m: $r.treedsl.global.Match = +m: $r.treedsl.global.Match = 10 match { case 5 => false case _ => true diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check index 7256b851bb..c6e147977a 100644 --- a/test/files/run/repl-reset.check +++ b/test/files/run/repl-reset.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> val x1 = 1 x1: Int = 1 @@ -51,5 +49,3 @@ scala> { new BippyBungus ; x1 } res2: Int = 4 scala> - -scala> diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check index eae489c294..2a143a1777 100644 --- a/test/files/run/repl-term-macros.check +++ b/test/files/run/repl-term-macros.check @@ -1,9 +1,7 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> import scala.reflect.macros.Context +scala> import scala.reflect.macros.Context import scala.reflect.macros.Context scala> import language.experimental.macros @@ -40,5 +38,3 @@ defined term macro foo3: (x: Int)(y: Int)Unit scala> foo3(2)(3) scala> - -scala> diff --git a/test/files/run/repl-transcript.check b/test/files/run/repl-transcript.check index 6d22353882..49891af900 100644 --- a/test/files/run/repl-transcript.check +++ b/test/files/run/repl-transcript.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> scala> class Bippity // Detected repl transcript paste: ctrl-D to finish. @@ -19,7 +17,6 @@ scala> 1 to 100 map (_ + 1) res6: scala.collection.immutable.IndexedSeq[Int] = Vector(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101) scala> res6.sum + res5 - // Replaying 5 commands from transcript. scala> class Bippity diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala index 70ee8e1840..483659146a 100644 --- a/test/files/run/repl-trim-stack-trace.scala +++ b/test/files/run/repl-trim-stack-trace.scala @@ -20,7 +20,7 @@ scala> def f = throw new Exception("") f: Nothing scala> f -java.lang.Exception: +java.lang.Exception: at .f(<console>:7) ... 69 elided diff --git a/test/files/run/repl-type-verbose.check b/test/files/run/repl-type-verbose.check index 989c0735b0..e37754a060 100644 --- a/test/files/run/repl-type-verbose.check +++ b/test/files/run/repl-type-verbose.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> // verbose! scala> :type -v def f = 5 @@ -165,7 +163,7 @@ PolyType( normalize = TypeRef( TypeSymbol( abstract trait Ordering[T] extends Comparator[T] with PartialOrdering[T] with Serializable - + ) args = List(TypeParamTypeRef(TypeParam(T))) ) @@ -190,5 +188,3 @@ PolyType( ) scala> - -scala> diff --git a/test/files/run/run-bug4840.scala b/test/files/run/run-bug4840.scala index 5f98bc9f4b..dda280fd17 100644 --- a/test/files/run/run-bug4840.scala +++ b/test/files/run/run-bug4840.scala @@ -1,6 +1,6 @@ object Test { def g(x: Boolean): Option[String] = if (x) Some("booya") else None - + def f1() = { for (x <- g(true)) yield { g(false) match { @@ -9,11 +9,11 @@ object Test { } } } - + def f2() = { for (x <- g(true) ; y <- g(true) ; z <- g(true)) yield { for (x <- g(true) ; y <- g(true) ; z <- g(true)) yield { - g(true) map { _ => + g(true) map { _ => (null: Any) match { case Some(x: Int) => x case _ => 5 @@ -21,7 +21,7 @@ object Test { } } } - } + } def main(args: Array[String]): Unit = { println(f1()) diff --git a/test/files/run/runtime-richChar.scala b/test/files/run/runtime-richChar.scala index cf18a1d302..dceb70e74d 100644 --- a/test/files/run/runtime-richChar.scala +++ b/test/files/run/runtime-richChar.scala @@ -5,19 +5,19 @@ object Test extends App { else println(name + " failed: " + expected + " differs from " + got) } - + testSeq("'a' to 'c'", List('a', 'b', 'c'), 'a' to 'c') testSeq("'a' until 'c'", List('a', 'b'), 'a' until 'c') - + testSeq("'a' to 'b'", List('a', 'b'), 'a' to 'b') testSeq("'a' until 'b'", List('a'), 'a' until 'b') - + testSeq("'a' to 'a'", List('a'), 'a' to 'a') testSeq("'a' until 'a'", List(), 'a' until 'a') - + testSeq("'b' to 'a'", List(), 'b' to 'a') testSeq("'b' until 'a'", List(), 'b' until 'a') - + testSeq("'c' to 'a'", List(), 'c' to 'a') testSeq("'c' until 'a'", List(), 'c' until 'a') } diff --git a/test/files/run/scan.scala b/test/files/run/scan.scala index f056c77ba1..47e0a7d976 100644 --- a/test/files/run/scan.scala +++ b/test/files/run/scan.scala @@ -6,17 +6,17 @@ object Test { def main(args: Array[String]) { val lst = List(1, 2, 3, 4, 5) - + assert(lst.scanLeft(0)(_ + _) == List(0, 1, 3, 6, 10, 15)) assert(lst.scanRight(0)(_ + _) == List(15, 14, 12, 9, 5, 0)) - + val emp = List[Int]() assert(emp.scanLeft(0)(_ + _) == List(0)) assert(emp.scanRight(0)(_ + _) == List(0)) - + val stream = Stream(1, 2, 3, 4, 5) assert(stream.scanLeft(0)(_ + _) == Stream(0, 1, 3, 6, 10, 15)) - + assert(Stream.from(1).scanLeft(0)(_ + _).take(5) == Stream(0, 1, 3, 6, 10)) } diff --git a/test/files/run/seqlike-kmp.scala b/test/files/run/seqlike-kmp.scala index 514990cfa2..af39fda9af 100644 --- a/test/files/run/seqlike-kmp.scala +++ b/test/files/run/seqlike-kmp.scala @@ -2,7 +2,7 @@ object Test { val source = 0 to 99 val idxes = (-1 to 2) ++ (97 to 100) def str(xs: Seq[Int]) = xs.mkString("(", ", ", ")") - + def f(tgt: Seq[Int]) = { println("indexOfSlice") // the first index `>= from` such that... @@ -17,11 +17,11 @@ object Test { println(" %s with idx <= %d = %d".format(str(tgt), x, res)) } } - + def g(idx: Int, len: Int) = { f(source.slice(idx, idx + len)) } - + def main(args: Array[String]): Unit = { g(97, 1) g(97, 2) diff --git a/test/files/run/sequenceComparisons.scala b/test/files/run/sequenceComparisons.scala index f8ef17d77d..613b37f45a 100644 --- a/test/files/run/sequenceComparisons.scala +++ b/test/files/run/sequenceComparisons.scala @@ -2,12 +2,12 @@ import scala.collection.{ mutable, immutable } import collection.{ Seq, Traversable } object Test { - // TODO: + // TODO: // // SeqProxy // SeqForwarder // the commented out ones in seqMakers - + val seqMakers = List[List[Int] => Seq[Int]]( // scala.Array(_: _*), mutable.ArrayBuffer(_: _*), @@ -23,13 +23,13 @@ object Test { immutable.Seq(_: _*), mutable.Seq(_: _*), immutable.Stack(_: _*), - // mutable.Stack(_: _*), + // mutable.Stack(_: _*), immutable.IndexedSeq(_: _*), // was Vector //mutable.Vector(_: _*), immutable.List(_: _*), immutable.Stream(_: _*) ) - + abstract class Data[T] { val seq: Seq[T] private def seqList = seq.toList @@ -45,50 +45,50 @@ object Test { } lazy val eqeq = Method(_ == _, (List(seqList), List(Nil, seqList drop 1, seqList ::: seqList)), "%s == %s") - + val startsWithInputs: Inputs lazy val startsWith = Method(_ startsWith _, startsWithInputs, "%s startsWith %s") - + val endsWithInputs: Inputs lazy val endsWith = Method(_ endsWith _, endsWithInputs, "%s endsWith %s") val indexOfSliceInputs: Inputs private def subseqTest(s1: Seq[T], s2: Seq[T]) = (s1 indexOfSlice s2) != -1 lazy val indexOfSlice = Method(subseqTest _, indexOfSliceInputs, "(%s indexOfSlice %s) != -1") - + val sameElementsInputs: Inputs lazy val sameElements = Method(_ sameElements _, sameElementsInputs, "%s sameElements %s") - + def methodList = List(eqeq, startsWith, endsWith, indexOfSlice, sameElements) } - + object test1 extends Data[Int] { val seq = List(1,2,3,4,5) - + val startsWithInputs = ( List(Nil, List(1), List(1,2), seq), List(List(1,2,3,4,6), seq ::: List(5), List(0)) ) - + val endsWithInputs = ( List(Nil, List(5), List(4,5), seq), List(0 :: seq, List(5,2,3,4,5), List(3,4), List(5,6)) ) - + val indexOfSliceInputs = ( List(Nil, List(1), List(3), List(5), List(1,2), List(2,3,4), List(4,5), seq), List(List(1,2,3,5), List(6), List(5,4,3,2,1), List(2,1)) ) - + val sameElementsInputs = ( List(List(1,2,3,4,5)), List(Nil, List(1), List(1,2), List(2,3,4), List(2,3,4,5), List(2,3,4,5,1), List(1,2,3,5,4), seq.reverse) ) } - + val failures = new mutable.ListBuffer[String] var testCount = 0 - + def assertOne(op1: Any, op2: Any, res: Boolean, str: String) { testCount += 1 val resStr = str.format(op1, op2) @@ -97,25 +97,25 @@ object Test { failures += ("FAIL: " + resStr) // assert(res, resStr) } - + def runSeqs() = { for (s1f <- seqMakers ; s2f <- seqMakers ; testData <- List(test1)) { import testData._ val scrut = s1f(seq) - + for (Method(f, (trueList, falseList), descr) <- methodList) { for (s <- trueList; rhs = s2f(s)) assertOne(scrut, rhs, f(scrut, rhs), descr) - + for (s <- falseList; rhs = s2f(s)) assertOne(scrut, rhs, !f(scrut, rhs), "!(" + descr + ")") } } } - + def main(args: Array[String]) { runSeqs() - + assert(failures.isEmpty, failures mkString "\n") } } diff --git a/test/files/run/serialize-stream.scala b/test/files/run/serialize-stream.scala index e424d5b629..3ab9f2df34 100644 --- a/test/files/run/serialize-stream.scala +++ b/test/files/run/serialize-stream.scala @@ -5,13 +5,13 @@ object Test { val bos = new java.io.ByteArrayOutputStream() val oos = new java.io.ObjectOutputStream(bos) oos.writeObject(s) - + val ois = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bos.toByteArray)) val obj = ois.readObject() println(obj) println(obj.asInstanceOf[Seq[T]].toList) } - + def main(args: Array[String]) { ser(Stream(1, 2, 3)) ser(Stream(1)) diff --git a/test/files/run/slice-strings.scala b/test/files/run/slice-strings.scala index 23085866f5..129314387a 100644 --- a/test/files/run/slice-strings.scala +++ b/test/files/run/slice-strings.scala @@ -1,7 +1,7 @@ -object Test { +object Test { def cmp(x1: String) = { val x2 = x1.toList - + -10 to 10 foreach { i => assert(x1.take(i) == x2.take(i).mkString) assert(x1.drop(i) == x2.drop(i).mkString) @@ -12,7 +12,7 @@ object Test { assert(x1.slice(idx1, idx2) == x2.slice(idx1, idx2).mkString) } } - + def main(args: Array[String]): Unit = { cmp("abcde") } diff --git a/test/files/run/sm-interpolator.scala b/test/files/run/sm-interpolator.scala index 7f7b9f061a..b99daa2a8b 100644 --- a/test/files/run/sm-interpolator.scala +++ b/test/files/run/sm-interpolator.scala @@ -1,14 +1,14 @@ object Test extends App { import scala.reflect.internal.util.StringContextStripMarginOps - def check(actual: Any, expected: Any) = if (actual != expected) sys.error(s"expected: [$expected], actual: [$actual])") + def check(actual: Any, expected: Any) = if (actual != expected) sys.error(s"\nexpected:\n$expected\n\nactual:\n$actual") val bar = "|\n ||" check( - sm"""|ab + sm"""|ab |de |${bar} | ${1}""", - "ab \nde\n|\n || | 1") + "ab\nde\n|\n || | 1") check( sm"|", diff --git a/test/files/run/spec-nlreturn.scala b/test/files/run/spec-nlreturn.scala index a84160ecca..5ab1747856 100644 --- a/test/files/run/spec-nlreturn.scala +++ b/test/files/run/spec-nlreturn.scala @@ -5,7 +5,7 @@ object Test { val g = (1 to 10 map { i => return 16 ; i }).sum g } - catch { case x: runtime.NonLocalReturnControl[_] => + catch { case x: runtime.NonLocalReturnControl[_] => println(x.getClass.getName) x.value.asInstanceOf[Int] } diff --git a/test/files/run/streamWithFilter.scala b/test/files/run/streamWithFilter.scala index 7f8f9a09d2..cb919d4f55 100644 --- a/test/files/run/streamWithFilter.scala +++ b/test/files/run/streamWithFilter.scala @@ -4,7 +4,7 @@ object Test { def isBuzz(x: Int) = x % 5 == 0 // next line will run forever if withFilter isn't doing its thing. val fizzbuzzes = for (n <- nums ; if isFizz(n) ; if isBuzz(n)) yield n - + def main(args: Array[String]): Unit = { fizzbuzzes take 5 foreach println } diff --git a/test/files/run/streams.scala b/test/files/run/streams.scala index 03b2622edd..350e103eab 100644 --- a/test/files/run/streams.scala +++ b/test/files/run/streams.scala @@ -41,7 +41,7 @@ object Test extends App { def powers(x: Int) = if ((x&(x-1)) == 0) Some(x) else None println(s3.flatMap(powers).reverse.head) - // large enough to generate StackOverflows (on most systems) + // large enough to generate StackOverflows (on most systems) // unless the following methods are tail call optimized. val size = 100000 diff --git a/test/files/run/stringbuilder.scala b/test/files/run/stringbuilder.scala index a88ea38b92..a98f9cf37d 100644 --- a/test/files/run/stringbuilder.scala +++ b/test/files/run/stringbuilder.scala @@ -4,21 +4,21 @@ import scala.language.reflectiveCalls object Test extends App { val str = "ABCDEFGHIJKLMABCDEFGHIJKLM" val surrogateStr = "an old Turkic letter: \uD803\uDC22" - - type SB = { + + type SB = { def indexOf(str: String): Int def indexOf(str: String, fromIndex: Int): Int def lastIndexOf(str: String): Int def lastIndexOf(str: String, fromIndex: Int): Int } - + import scala.collection.mutable.{ StringBuilder => ScalaStringBuilder } import java.lang.{ StringBuilder => JavaStringBuilder } - + val sbScala = new ScalaStringBuilder() append str val sbJava = new JavaStringBuilder() append str val sbs: List[SB] = List[SB](sbScala, sbJava) - + def sameAnswers(f: (SB) => Int) = assert(f(sbScala) == f(sbJava)) sameAnswers(_.indexOf("")) @@ -34,10 +34,10 @@ object Test extends App { sameAnswers(_.lastIndexOf("QZV")) sameAnswers(_.lastIndexOf("GHI", 22)) sameAnswers(_.lastIndexOf("KLM", 22)) - + // testing that the "reverse" implementation avoids reversing surrogate pairs val jsb = new JavaStringBuilder(surrogateStr).reverse val ssb = new ScalaStringBuilder(surrogateStr).reverseContents - + assert(jsb.toString == ssb.toString) } diff --git a/test/files/run/structural.scala b/test/files/run/structural.scala index 2788717ec2..7da104ca6e 100644 --- a/test/files/run/structural.scala +++ b/test/files/run/structural.scala @@ -2,20 +2,20 @@ import scala.language.{ reflectiveCalls } object test1 { - + val o1 = new Object { override def toString = "ohone" } val o2 = new Object { override def toString = "ohtwo" } - + val t1 = new Tata("tieone") val t2 = new Tata("tietwo") - + class Tata(name: String) { override def toString = name def tatMe = "oy" } - + class Titi extends Tata("titi") - + object Rec { val a = 1 val b = 2 @@ -44,7 +44,7 @@ object test1 { val y: Tata = null def z(t: Tata) = () } - + type rt = Object { val a: Int; val c: String; @@ -68,7 +68,7 @@ object test1 { var v: Int val y: Tata } - + def l (r: rt) { println(" 1. " + r.c) println(" 2. " + r.a + 1) @@ -97,33 +97,33 @@ object test1 { println("25. " + r.y) println("26. " + r.e(null)) } - + /*def ma[T](r: Object{def e(x: T): T; val x: T}) { println("30. " + r.e(r.x)) // static error }*/ - + def mb(r: Object { def e[T](x: T): T }) { println("31. " + r.e[Int](4)) // while this is ok } - + def m1(r: Object { def z(x: Tata): Unit }) { println("32. " + r.z(new Titi)) // while this is ok } - + def m2[T](r: Object { def e(x: Tata): T; val x: Tata }) { println("33. " + r.e(r.x)) // and this too } - + class Rec3[T] { def e(x: T): T = x } - + def m3[T](r: Rec3[T], x: T) { println("33. " + r.e(x)) // and this too } - + Rec.g(11) - + this.l(Rec) this.mb(new Object{def e[T](x: T): T = x}) this.m1(Rec) @@ -135,7 +135,7 @@ object test2 { class C extends { def f() { println("1") } } val x1 = new C x1.f() - + abstract class D extends { def f() } val x2 = new D { def f() { println("2") } } x2.f() @@ -156,11 +156,11 @@ object test2 { object test3 { case class Exc() extends Exception - + object Rec { def f = throw Exc() } - + def m(r: { def f: Nothing }) = try { r.f @@ -169,31 +169,31 @@ object test3 { case e: Exc => println("caught") case e: Throwable => println(e) } - + m(Rec) - + } object test4 { class A - + val aar = Array(new A, new A, new A) val nar = Array(1, 2) - + def f(p: {def size: Int}) = println(p.size) //def g[T <: {def size: Int}](p: T) = println(p.size) // open issue //def h[T <% {def size: Int}](p: T) = println(p.size) // open issue - + f(aar) f(nar) - + //g(aar) //g(nar) - + //h(aar) //h(nar) - + } object Test extends App { diff --git a/test/files/run/sysprops.scala b/test/files/run/sysprops.scala index 4d98e2cdd0..bdad677221 100644 --- a/test/files/run/sysprops.scala +++ b/test/files/run/sysprops.scala @@ -3,16 +3,16 @@ import sys._ /** Basic sys.Prop test. */ object Test { val key = "ding.dong.doobie" - + def bool() = { val prop = BooleanProp.valueIsTrue(key) assert(prop.key == key) - + prop.clear() assert(!prop.value) assert(!prop.isSet) assert(prop.get != null) - + prop set "dingus" assert(prop.get == "dingus") assert(!prop.value) @@ -32,7 +32,7 @@ object Test { prop.set("523") assert(prop.value == 523) prop.set("DingusInt") - + try { println(prop.value) ; assert(false, "should not get here") } catch { case _: Exception => () } } @@ -41,7 +41,7 @@ object Test { prop.set("55.0") assert(prop.value == 55.0) } - + def main(args: Array[String]): Unit = { bool() int() diff --git a/test/files/run/t0017.scala b/test/files/run/t0017.scala index e976f453d8..245cbb7e42 100644 --- a/test/files/run/t0017.scala +++ b/test/files/run/t0017.scala @@ -7,7 +7,7 @@ def transpose[A](arr: Array[Array[A]]) = { var my_arr = Array(Array(1,2),Array(3,4)) -for (i <- Array.range(0, my_arr(0).length)) yield +for (i <- Array.range(0, my_arr(0).length)) yield for (row <- my_arr) yield row(i) val transposed = transpose(my_arr) diff --git a/test/files/run/t0325.scala b/test/files/run/t0325.scala index 048303206c..a126a3a204 100644 --- a/test/files/run/t0325.scala +++ b/test/files/run/t0325.scala @@ -7,7 +7,7 @@ case class RS(self: String) { } def split(separator: Char): Array[String] = self.split(escape(separator)) - + def split(separators: Array[Char]): Array[String] = { val re = separators.foldLeft("[")(_+escape(_)) + "]" self.split(re) @@ -27,7 +27,7 @@ object Test { case e: Throwable => println(which + " failed with " + e.getClass) } } - + def main(args: Array[String]) { val badChars = "?*{+([\\^.$" @@ -46,8 +46,8 @@ object Test { for ((c,str) <- badCases) test(("a"+c+"b").split(str.toArray),"RichString split(\""+ str + "\")") println - + for ((c,str) <- badCases) - test(RS("a"+c+"b").split(str.toArray),"RS split(\""+ str + "\")") + test(RS("a"+c+"b").split(str.toArray),"RS split(\""+ str + "\")") } } diff --git a/test/files/run/t0421-old.scala b/test/files/run/t0421-old.scala index 9b88b4789b..dde89bc542 100644 --- a/test/files/run/t0421-old.scala +++ b/test/files/run/t0421-old.scala @@ -9,17 +9,17 @@ object Test extends App { } def scalprod(xs: Array[Double], ys: Array[Double]) = { - var acc = 0.0 - for ((x, y) <- xs zip ys) acc = acc + x * y + var acc = 0.0 + for ((x, y) <- xs zip ys) acc = acc + x * y acc } def matmul(xss: Array[Array[Double]], yss: Array[Array[Double]]) = { - val ysst = transpose(yss) + val ysst = transpose(yss) val ysst1: Array[Array[Double]] = yss.transpose assert(ysst.deep == ysst1.deep) for (xs <- xss) yield - for (yst <- ysst) yield + for (yst <- ysst) yield scalprod(xs, yst) } @@ -27,6 +27,6 @@ object Test extends App { println(transpose(a1).deep.mkString("[", ",", "]")) println(matmul(Array(Array(2, 3)), Array(Array(5), Array(7))).deep.mkString("[", ",", "]")) - + println(matmul(Array(Array(4)), Array(Array(6, 8))).deep.mkString("[", ",", "]")) } diff --git a/test/files/run/t0508.scala b/test/files/run/t0508.scala index 0f4325e629..2283c46c36 100644 --- a/test/files/run/t0508.scala +++ b/test/files/run/t0508.scala @@ -9,5 +9,5 @@ object Test extends App { } } - foo(Foo.unapply, Foo("this might be fun", 10)) + foo(Foo.unapply, Foo("this might be fun", 10)) } diff --git a/test/files/run/t0631.scala b/test/files/run/t0631.scala index 5bceab6193..c401ed31cb 100644 --- a/test/files/run/t0631.scala +++ b/test/files/run/t0631.scala @@ -1,5 +1,5 @@ object Test extends App { - class Foo { + class Foo { override def equals(that: Any) = { println("Foo.equals called") super.equals(that) diff --git a/test/files/run/t0677-old.scala b/test/files/run/t0677-old.scala index c0f1abae53..8d4c3ee060 100644 --- a/test/files/run/t0677-old.scala +++ b/test/files/run/t0677-old.scala @@ -2,7 +2,7 @@ @deprecated("Suppress warnings", since="2.11") object Test extends App { - class X[T: ClassManifest] { + class X[T: ClassManifest] { val a = Array.ofDim[T](3, 4) } val x = new X[String] diff --git a/test/files/run/t0807.scala b/test/files/run/t0807.scala index 1a1add6b3a..1e2a26664a 100644 --- a/test/files/run/t0807.scala +++ b/test/files/run/t0807.scala @@ -1,5 +1,5 @@ trait A -trait B extends A { val x = println("early") } +trait B extends A { val x = println("early") } object Test extends App { new B {} } diff --git a/test/files/run/t0883.scala b/test/files/run/t0883.scala index adde95197b..c8ed06dbfe 100644 --- a/test/files/run/t0883.scala +++ b/test/files/run/t0883.scala @@ -1,14 +1,14 @@ object Foo { def apply(x: String) = new Foo(x) } class Foo(name: String) case object Bar extends Foo("Bar") -case class Baz() extends Foo("Baz") +case class Baz() extends Foo("Baz") object Test extends App { - Foo("Bar") match { - case Bar => println("What?") + Foo("Bar") match { + case Bar => println("What?") case _ => println("OK") } - Foo("Baz") match { - case Baz() => println("What?") + Foo("Baz") match { + case Baz() => println("What?") case _ => println("OK") - } + } } diff --git a/test/files/run/t1005.scala b/test/files/run/t1005.scala index 575ec43565..562e2e4c6d 100644 --- a/test/files/run/t1005.scala +++ b/test/files/run/t1005.scala @@ -11,7 +11,7 @@ object Test object FromPoly{ def mainer(args : Array[String]) = (new Bar[AnyRef](Array[AnyRef]("Halp!"))).bar } - + def main(args: Array[String]): Unit = { println(FromMono mainer null mkString) println(FromPoly mainer null mkString) diff --git a/test/files/run/t1141.scala b/test/files/run/t1141.scala index b907b4798f..732c57943c 100644 --- a/test/files/run/t1141.scala +++ b/test/files/run/t1141.scala @@ -6,6 +6,6 @@ object Test extends App { val foo = new { def apply(args : String*) = args foreach println } - + foo("var", "args") } diff --git a/test/files/run/t1167.scala b/test/files/run/t1167.scala index c2ec4cff4e..3dd0a30c00 100644 --- a/test/files/run/t1167.scala +++ b/test/files/run/t1167.scala @@ -10,17 +10,17 @@ trait Test1 { /* getName * Returns the binary name of the class if this class object represents a - * reference type that is not an array type. + * reference type that is not an array type. * getSimpleName * Returns the simple name of the underlying class as given in the source * code. Returns an empty string if the underlying class is anonymous. */ abstract class Foo { override def toString = getClass.getSimpleName - + abstract class Bar { override def toString = getClass.getSimpleName - } + } } object Test extends App { diff --git a/test/files/run/t1220.scala b/test/files/run/t1220.scala index 0ba188d02d..75e0ea07e8 100644 --- a/test/files/run/t1220.scala +++ b/test/files/run/t1220.scala @@ -1,7 +1,7 @@ object Test extends App { class QSRichIterable[A](self: Iterable[A]) { - def filterMap[R](f: PartialFunction[A,R]) = + def filterMap[R](f: PartialFunction[A,R]) = self filter (f.isDefinedAt) map f } diff --git a/test/files/run/t1300.scala b/test/files/run/t1300.scala index ce2f80eb4e..aa3580e33c 100644 --- a/test/files/run/t1300.scala +++ b/test/files/run/t1300.scala @@ -4,10 +4,10 @@ object Test extends App // val a1 = x1.toArray[Any] val a2 = Array('a','b','c','d').toArray[Any] val a3 = Array("e","f","g","h").toArray[Any] - + Array.copy(a3, 0, a1, 0, 4) Array.copy(a2, 0, a3, 0, 4) Array.copy(a2, 0, a1, 0, 4) - + println(a1.mkString + a2.mkString + a3.mkString) } diff --git a/test/files/run/t1309.scala b/test/files/run/t1309.scala index b6a75fe6ae..84963549a2 100644 --- a/test/files/run/t1309.scala +++ b/test/files/run/t1309.scala @@ -1,6 +1,6 @@ object Test { def f(ras: => IndexedSeq[Byte]): IndexedSeq[Byte] = ras - + def main(args: Array[String]): Unit = { f(new Array[Byte](0)) } diff --git a/test/files/run/t1323.scala b/test/files/run/t1323.scala index 8209b85219..94b51bd2a4 100644 --- a/test/files/run/t1323.scala +++ b/test/files/run/t1323.scala @@ -3,9 +3,9 @@ object Test extends App { println(" 2:" + List(1,2,3,4).indexOfSlice(List(1,2))) // 0 println(" 3:" + List(1,2,3,4).indexOfSlice(List(2,3))) // 1 println(" 4:" + List(1,2,3,4).indexOfSlice(List(3,4))) // 2 - println(" 5:" + List(1,2,3,4).indexOfSlice(List(4,5))) // -1 + println(" 5:" + List(1,2,3,4).indexOfSlice(List(4,5))) // -1 println(" 6:" + List(1,2,3,4).indexOfSlice(List(2,4))) // -1 - println(" 7:" + List(1,2,3,4).indexOfSlice(List(4,3))) // -1 + println(" 7:" + List(1,2,3,4).indexOfSlice(List(4,3))) // -1 println(" 8:" + List(1,2,3,4).indexOfSlice(List(1,3))) // -1 println(" 9:" + List(1,2,3,4).indexOfSlice(List(1,3))) // -1 println("10:" + List(1,2,3,4).indexOfSlice(List(1,2,3,4))) // 0 diff --git a/test/files/run/t1333.scala b/test/files/run/t1333.scala index 514b4ffc8a..1696629cbb 100644 --- a/test/files/run/t1333.scala +++ b/test/files/run/t1333.scala @@ -1,11 +1,11 @@ object Test { case class A(x: Int)(y: Int)(z: String) - + def f(x: Any) = x match { case A(x) => x case _ => -1 } - + def main(args: Array[String]): Unit = { println(f(A(10)(20)("abc"))) println(f(A(-10)(20)("abc"))) diff --git a/test/files/run/t1423.scala b/test/files/run/t1423.scala index 44c6653287..073483aeee 100644 --- a/test/files/run/t1423.scala +++ b/test/files/run/t1423.scala @@ -5,4 +5,4 @@ object Test extends App{ case 1L => println(1); case _ => println("????"); } -} +} diff --git a/test/files/run/t1427.scala b/test/files/run/t1427.scala index eeb2603c26..4b8057ffe8 100644 --- a/test/files/run/t1427.scala +++ b/test/files/run/t1427.scala @@ -12,7 +12,7 @@ object Test { def main(args: Array[String]): Unit = { val x = new Bob[List] val results = List(x, new Bob[Set], 55) map (x foo _) - + assert(results == List(true, true, false)) } } diff --git a/test/files/run/t1430/Bar_1.java b/test/files/run/t1430/Bar_1.java index 4db2eafcbd..e49b6becb2 100644 --- a/test/files/run/t1430/Bar_1.java +++ b/test/files/run/t1430/Bar_1.java @@ -2,7 +2,7 @@ package j; interface Foo { public void foo(); -} +} public interface Bar_1 extends Foo { public void bar(); -} +} diff --git a/test/files/run/t1430/Test_2.scala b/test/files/run/t1430/Test_2.scala index 7af65de5cd..278d9c7fd3 100644 --- a/test/files/run/t1430/Test_2.scala +++ b/test/files/run/t1430/Test_2.scala @@ -6,7 +6,7 @@ package s { class Baz(x: j.Bar_1) { x.foo override def toString = "Baz" - } + } } object Test { diff --git a/test/files/run/t1505.scala b/test/files/run/t1505.scala index d7feb30ce3..4afbb99ef7 100644 --- a/test/files/run/t1505.scala +++ b/test/files/run/t1505.scala @@ -18,5 +18,5 @@ object Test extends App { var failed = false try { Q.withName("x") } catch { case _: NoSuchElementException => failed = true } assert(failed) - + } diff --git a/test/files/run/t1537.scala b/test/files/run/t1537.scala index ddbfb29ac4..1dce501990 100644 --- a/test/files/run/t1537.scala +++ b/test/files/run/t1537.scala @@ -4,15 +4,15 @@ trait Syntax { trait Evaluation { val syntax: Syntax - + def equalInTrait = this.syntax.Foo == this.syntax.Foo } object Test extends Evaluation with App { - object syntax extends Syntax + object syntax extends Syntax def equalInObject = this.syntax.Foo == this.syntax.Foo - + println(equalInTrait) println(equalInObject) } diff --git a/test/files/run/t1591.scala b/test/files/run/t1591.scala index bd43f0b23d..6dd9605042 100644 --- a/test/files/run/t1591.scala +++ b/test/files/run/t1591.scala @@ -1,8 +1,8 @@ abstract class A { - + lazy val lazyBar = bar - - object bar { + + object bar { val foo = 12 } diff --git a/test/files/run/t1718.scala b/test/files/run/t1718.scala index 358bd1be5a..d1b19c38cd 100644 --- a/test/files/run/t1718.scala +++ b/test/files/run/t1718.scala @@ -1,10 +1,10 @@ object Test extends App{ - def matchesNull[T](mightBeNull: Array[T]): Boolean = mightBeNull match { + def matchesNull[T](mightBeNull: Array[T]): Boolean = mightBeNull match { case null => true case x => false } val nullArray: Array[String] = null - println(matchesNull(nullArray)) + println(matchesNull(nullArray)) } diff --git a/test/files/run/t1766.scala b/test/files/run/t1766.scala index 7d12451092..ff81da3f8e 100644 --- a/test/files/run/t1766.scala +++ b/test/files/run/t1766.scala @@ -2,18 +2,18 @@ import scala.language.{ reflectiveCalls } object Test extends App { - + class C(s: String) { - + def this(i: Int) = this("bar") - + def f = { val v: { def n: Int } = new { val n = 3 } v.n } - + } - + new C("foo").f - + } diff --git a/test/files/run/t1829.scala b/test/files/run/t1829.scala index 7c39d33ae9..8240527424 100644 --- a/test/files/run/t1829.scala +++ b/test/files/run/t1829.scala @@ -1,6 +1,6 @@ object Test{ def main(args : Array[String]){ - import scala.collection.immutable._ + import scala.collection.immutable._ assert(IntMap.empty == HashMap.empty); assert(HashMap.empty == IntMap.empty); assert(LongMap.empty == HashMap.empty); diff --git a/test/files/run/t1987.scala b/test/files/run/t1987.scala index 4c278ec6a0..de869edea0 100644 --- a/test/files/run/t1987.scala +++ b/test/files/run/t1987.scala @@ -5,7 +5,7 @@ package foo { package object bar { def duh(n: Long) = println("long") def duh(n: Double) = println("double") - + def duh2(n: Double) = println("double") def duh2(n: Long) = println("long") } @@ -16,7 +16,7 @@ package foo { bip.bar.duh(33L) duh(33d) bip.bar.duh(33d) - + duh2(33L) bip.bar.duh2(33L) duh2(33d) @@ -35,7 +35,7 @@ package bip { def duh2(n: Double) = println("double") def duh2(n: Long) = println("long") } - + package object bar extends Duh with Duh2 { } package bar { object Main { @@ -44,7 +44,7 @@ package bip { bip.bar.duh(33L) duh(33d) bip.bar.duh(33d) - + duh2(33L) bip.bar.duh2(33L) duh2(33d) diff --git a/test/files/run/t2029.scala b/test/files/run/t2029.scala index 1cbe97a350..32b04f0b47 100644 --- a/test/files/run/t2029.scala +++ b/test/files/run/t2029.scala @@ -3,10 +3,10 @@ object Test{ import scala.collection.immutable.TreeSet; val mainSet = TreeSet(1 to 5 :_*) - + var compareCalled = false; val smallerSet = TreeSet(2 to 4 :_*)(Ordering[Int].reverse) - + println(mainSet.mkString(",")) println(smallerSet.mkString(",")) println(smallerSet.subsetOf(mainSet)); diff --git a/test/files/run/t2074_2.scala b/test/files/run/t2074_2.scala index 1f59e0b8a1..4624170f89 100644 --- a/test/files/run/t2074_2.scala +++ b/test/files/run/t2074_2.scala @@ -12,7 +12,7 @@ object Test { def iterator = underlying.iterator } val w = IndexedSeq(1, 2, 3).view - + def main(args: Array[String]): Unit = { println(v) println(w) diff --git a/test/files/run/t2087-and-2400.scala b/test/files/run/t2087-and-2400.scala index 93cd633ffb..19a5df26e3 100644 --- a/test/files/run/t2087-and-2400.scala +++ b/test/files/run/t2087-and-2400.scala @@ -3,14 +3,14 @@ object Test def negativeCharMaker = new (Short => Char) { def apply(x: Short) = x.toChar } def main(args: Array[String]): Unit = { // throws exception if -100 gets to Character.valueOf - val x = negativeCharMaker(-100) - + val x = negativeCharMaker(-100) + // chars are unsigned, they should never be equal to negative values assert((-100).toShort != (-100).toChar) assert((-100).toChar != (-100).toShort) assert((-100).toChar != (-100).toByte) assert((-100).toByte != (-100).toChar) - + // BoxesRunTime must agree as well assert(((-100).toShort: Any) != (-100).toChar) assert(((-100).toChar: Any) != (-100).toShort) diff --git a/test/files/run/t2296c/Action.java b/test/files/run/t2296c/Action.java index 50ba9a4de1..4a6b69a5b8 100644 --- a/test/files/run/t2296c/Action.java +++ b/test/files/run/t2296c/Action.java @@ -8,7 +8,7 @@ public abstract class Action { public Action(Global glob0) { m_glob = glob0; } - + public Action() { this(null); } diff --git a/test/files/run/t2308a.scala b/test/files/run/t2308a.scala index 200dee1ef6..d1144db37d 100644 --- a/test/files/run/t2308a.scala +++ b/test/files/run/t2308a.scala @@ -2,8 +2,8 @@ import scala.language.{ higherKinds } object Test { trait T[M[_]] - + def f1 = classOf[T[X] forSome { type X[_] } ] - + def main(args: Array[String]): Unit = println(f1) } diff --git a/test/files/run/t2318.scala b/test/files/run/t2318.scala index d7fd9fdd41..b638c433f5 100644 --- a/test/files/run/t2318.scala +++ b/test/files/run/t2318.scala @@ -4,7 +4,7 @@ import scala.language.{ reflectiveCalls } object Test { trait Bar { def bar: Unit } - + object Mgr extends SecurityManager { override def checkPermission(perm: Permission) = perm match { case _: java.lang.RuntimePermission => () @@ -14,11 +14,11 @@ object Test { case _ => super.checkPermission(perm) } } - + def t1() = { val p = Runtime.getRuntime().exec("ls"); type Destroyable = { def destroy() : Unit } - def doDestroy( obj : Destroyable ) : Unit = obj.destroy(); + def doDestroy( obj : Destroyable ) : Unit = obj.destroy(); doDestroy( p ); } def t2() = { @@ -30,12 +30,12 @@ object Test { val structural = b.asInstanceOf[{ def bar: Unit }] structural.bar } - + def main(args: Array[String]) { // figuring this will otherwise break on windows try t1() catch { case _: java.io.IOException => () } - + t2() } } diff --git a/test/files/run/t2337.scala b/test/files/run/t2337.scala index 86a372ce56..edb574cba4 100644 --- a/test/files/run/t2337.scala +++ b/test/files/run/t2337.scala @@ -10,7 +10,7 @@ object Test { // throw new Exception("Unsupported compare " + first + "; " + second) } } - + def main(args: Array[String]): Unit = { println("Both Int", -1, compare(0, 1)) println("Both Float", 1, compare(1.0, 0.0)) diff --git a/test/files/run/t2417.scala b/test/files/run/t2417.scala index 18b6c326b5..8d1527e2d6 100644 --- a/test/files/run/t2417.scala +++ b/test/files/run/t2417.scala @@ -1,6 +1,6 @@ // #2417 object Test { - + def parallel(numThreads: Int)(block: => Unit) { var failure: Throwable = null val threads = Array.tabulate(numThreads)(i => new Thread { @@ -16,7 +16,7 @@ object Test { for (t <- threads) t.join if (failure != null) println("FAILURE: " + failure) } - + def testSet(initialSize: Int, numThreads: Int, passes: Int) { val orig = Set.empty ++ (1 to initialSize) parallel(numThreads) { @@ -32,7 +32,7 @@ object Test { } } } - + def testMap(initialSize: Int, numThreads: Int, passes: Int) { val orig = Map.empty ++ ((1 to initialSize) map ((_,"v"))) parallel(numThreads) { @@ -48,28 +48,28 @@ object Test { } } } - + def main(args: Array[String]) { println("testing small Map that doesn't promote to HashMap...") testMap(4, 2, 1000000) println() - + println("testing single-threaded HashMap use...") testMap(5, 1, 1000000) println() - + println("testing HashMap.size from multiple threads...") testMap(5, 2, 1000000) println() - + println("testing small Set that doesn't promote to HashSet...") testSet(4, 2, 1000000) println() - + println("testing single-threaded HashSet use...") testSet(5, 1, 1000000) println() - + println("testing HashSet.size from multiple threads...") testSet(5, 2, 1000000) println() diff --git a/test/files/run/t2512.scala b/test/files/run/t2512.scala index de20af5e72..8166839a9a 100644 --- a/test/files/run/t2512.scala +++ b/test/files/run/t2512.scala @@ -3,11 +3,11 @@ import scala.tools.nsc.util.HashSet object Test { val runs = 10000 class Bop - + def main(args: Array[String]): Unit = { val set: HashSet[Bop] = HashSet("Bop", 16) (1 to runs).toList foreach (_ => set addEntry new Bop) - + assert(runs == set.size && set.size == set.iterator.length) } } diff --git a/test/files/run/t2514.scala b/test/files/run/t2514.scala index cf5fa0ea02..0bf716e8bb 100644 --- a/test/files/run/t2514.scala +++ b/test/files/run/t2514.scala @@ -5,7 +5,7 @@ import scala.language.{ implicitConversions, postfixOps, reflectiveCalls } object Test { implicit def x[A](a: A) = new { def xx = a } - + def main(args: Array[String]): Unit = { val r1 = 12 xx; val r2 = 12.xx @@ -13,7 +13,7 @@ object Test val r4 = 12.xx + 12.xx val r5 = 12.`xx` + 12.xx val r6 = 12.3.`xx` + 12.xx - + assert(r5 == 24) } } diff --git a/test/files/run/t2526.scala b/test/files/run/t2526.scala index d37185535f..53f3059135 100644 --- a/test/files/run/t2526.scala +++ b/test/files/run/t2526.scala @@ -4,18 +4,18 @@ */ object Test { import collection._ - + def main(args: Array[String]) { val m = new mutable.HashMap[String, String] - + /* Use non hash-based structure for verification */ val keys = List("a", "b", "c", "d", "e") val valueSuffix = "value" val values = keys.map(_ + valueSuffix) val entries = keys.zip(values) - + for (k <- keys) m(k) = k + valueSuffix - + assertForeach(keys, m.keySet.iterator) assertForeach(keys, m.keysIterator) assertForeach(keys, m.keySet) @@ -25,7 +25,7 @@ object Test { assertForeach(entries, m) } - + /* Checks foreach of `actual` goes over all the elements in `expected` */ private def assertForeach[E](expected: Traversable[E], actual: Iterator[E]): Unit = { val notYetFound = new mutable.ArrayBuffer[E]() ++= expected @@ -35,12 +35,12 @@ object Test { } assert(notYetFound.size == 0, "mutable.HashMap.foreach should have iterated over: " + notYetFound) } - - /* + + /* * Checks foreach of `actual` goes over all the elements in `expected` * We duplicate the method above because there is no common inteface between Traversable and * Iterator and we want to avoid converting between collections to ensure that we test what - * we mean to test. + * we mean to test. */ private def assertForeach[E](expected: Traversable[E], actual: Traversable[E]): Unit = { val notYetFound = new mutable.ArrayBuffer[E]() ++= expected diff --git a/test/files/run/t2552.scala b/test/files/run/t2552.scala index 17dcac596b..0c6b4f005b 100644 --- a/test/files/run/t2552.scala +++ b/test/files/run/t2552.scala @@ -2,11 +2,11 @@ object Test extends App { def testTakeWhile = { val numbers = Iterator.range(0, 50) val zeroTo9 = numbers.takeWhile(x => { println("p(" + x + ")"); x < 10 } ) - + zeroTo9.foreach(println _) - + val zeroTo1 = Iterator.range(0, 20).takeWhile(x => { println("p(" + x + ")"); x < 2 } ) - + println(zeroTo1.hasNext) println(zeroTo1.hasNext) println(zeroTo1.next) @@ -15,16 +15,16 @@ object Test extends App { println(zeroTo1.hasNext) println(zeroTo1.hasNext) } - + def testFilter = { val predicate = (x: Int) => { println("p(" + x + ")"); x % 2 == 0 } - + val evens = Iterator.range(0, 10).filter(predicate) - + println(evens.hasNext) println(evens.hasNext) println(evens.next) - + evens.foreach(println _) } diff --git a/test/files/run/t2636.scala b/test/files/run/t2636.scala index 6ae2248a26..2f55c8ad5a 100644 --- a/test/files/run/t2636.scala +++ b/test/files/run/t2636.scala @@ -6,28 +6,28 @@ object Test type Foo = { def update(x: Int, value: String): Unit } type Foo2 = { def update(x: Int, value: String): Int } type Foo3 = { def update(x: Int, value: String): Array[Int] } - + def alen() = { type L1 = { def length: Int } def len(p: L1) = p.length val x: L1 = Array(1,2,3) len(x) } - + type A1 = { def apply(x: Int): String } def arrApply(a: A1, x: Int) = a(x) - + def main(args: Array[String]): Unit = { val arr = new Array[String](3) val p1: Foo = arr def a1 = p1(0) = "b" val p2: Foo2 = new { def update(x: Int, value: String) = { p1(1) = "o" ; 1 } } - def a2 = p2(0) = "c" - + def a2 = p2(0) = "c" + val p3: Foo3 = new { def update(x: Int, value: String) = { p1(2) = "b" ; Array(1) } } def a3 = p3(10) = "hi mom" - + a1 ; a2 ; a3 ; assert(arr.mkString == "bob") diff --git a/test/files/run/t266.scala b/test/files/run/t266.scala index 1fd6dab185..20a29dabbb 100644 --- a/test/files/run/t266.scala +++ b/test/files/run/t266.scala @@ -2,9 +2,9 @@ trait O { self: Test.type => - + Nil foreach identity - + def f = (1 to 10).toList map identity } diff --git a/test/files/run/t2755.scala b/test/files/run/t2755.scala index c279ecc24e..8d10b56734 100644 --- a/test/files/run/t2755.scala +++ b/test/files/run/t2755.scala @@ -28,7 +28,7 @@ object Test { case x: Array[_] => 6 case _ => 7 } - + def main(args: Array[String]): Unit = { println(f1(Array(1, 2, 3))) @@ -38,7 +38,7 @@ object Test { println(f1(new Array[Any](10))) // should match as Array[AnyRef] println(f1(Array(1L))) println(f1(null)) - + println(f2(Array(1, 2, 3))) println(f2(Array(1.0, -2.0, 3.0, 1.0))) println(f2(Array(1.0f, 2.0f, 3.0f, -3.0f))) @@ -46,7 +46,7 @@ object Test { println(f2(new Array[Any](10))) // should match as Array[AnyRef] println(f2(Array(1L))) println(f2(null)) - + println(f3(Array(1, 2, 3))) println(f3(Array(1.0, -2.0, 3.0, 1.0))) println(f3(Array(1.0f, 2.0f, 3.0f, -3.0f))) diff --git a/test/files/run/t2800.scala b/test/files/run/t2800.scala index cc6fb30bbc..84d1de0507 100644 --- a/test/files/run/t2800.scala +++ b/test/files/run/t2800.scala @@ -3,20 +3,20 @@ object Test { def f2 = (5: Any) match { case List(x @ _*) => x ; case _ => false } def f3 = (Nil: Any) match { case List(x @ _*) => x ; case _ => false } def f4 = (Array(1): Any) match { case List(x @ _*) => x ; case _ => false } - + def f5 = ("": Any) match { case Array(x @ _*) => x ; case _ => false } def f6 = (5: Any) match { case Array(x @ _*) => x ; case _ => false } def f7 = (Nil: Any) match { case Array(x @ _*) => x ; case _ => false } def f8 = (Array(1): Any) match { case Array(x @ _*) => x ; case _ => false } - + def f9 = ("": Any) match { case x @ List(_*) => x ; case _ => false } def f10 = ("": Any) match { case List(_*) => true ; case _ => false } def f11 = (Nil: Any) match { case List(_*) => true ; case _ => false } def f12 = ("": Any) match { case x @ Array(_*) => x ; case _ => false } def f13 = ("": Any) match { case Array(_*) => true ; case _ => false } def f14 = (Nil: Any) match { case Array(_*) => true ; case _ => false } - - + + def main(args: Array[String]): Unit = { println(f1) println(f2) diff --git a/test/files/run/t2818.scala b/test/files/run/t2818.scala index 19b67cbc88..746cdfb049 100644 --- a/test/files/run/t2818.scala +++ b/test/files/run/t2818.scala @@ -1,6 +1,6 @@ object Test extends App { println((List.range(1L, 15L) :\ 0L) (_ + _)) println((List.range(1L, 1000000L) :\ 0L) (_ + _)) - println((List.fill(5)(1) :\ 1) (_ - _)) - println((List.fill(1000000)(1) :\ 1) (_ - _)) + println((List.fill(5)(1) :\ 1) (_ - _)) + println((List.fill(1000000)(1) :\ 1) (_ - _)) } diff --git a/test/files/run/t2849.scala b/test/files/run/t2849.scala index 0995f64010..cadf605ae0 100644 --- a/test/files/run/t2849.scala +++ b/test/files/run/t2849.scala @@ -16,9 +16,9 @@ object Test { def ticketExample { var big = 100000 - + var aSortedSet: SortedSet[Int] = TreeSet(big) - + for (i <- 1 until N) { aSortedSet = (aSortedSet - big) ++ (TreeSet(i, big - 1)) big -= 1 @@ -42,7 +42,7 @@ object Test { } } } - + } diff --git a/test/files/run/t2867.scala b/test/files/run/t2867.scala index 0d30f95f8d..25e55eaecd 100644 --- a/test/files/run/t2867.scala +++ b/test/files/run/t2867.scala @@ -1,6 +1,6 @@ object Test { - case class A(l: List[_]*) - + case class A(l: List[_]*) + def main(args: Array[String]): Unit = { /** Kind of sneaking a slightly different test in here as well as * testing 2867. How subversive. @@ -9,7 +9,7 @@ object Test { val xs2 = List(1.0, 2.0, 3.0) val xs3 = List[Any](1.0f, 2.0f, 3.0f) val xs4 = List[Byte](1, 2, 3) - + assert(A(List(xs1, xs2)) == A(List(xs3, xs4))) } } diff --git a/test/files/run/t2958.scala b/test/files/run/t2958.scala index b9563a1b77..dcd24ecc36 100644 --- a/test/files/run/t2958.scala +++ b/test/files/run/t2958.scala @@ -2,14 +2,14 @@ object Test { def f(args: Array[String]) = args match { case Array("-p", prefix, from, to) => prefix + from + to - + case Array(from, to) => from + to case _ => "default" } - + def main(args: Array[String]) { assert(f(Array("1", "2")) == "12") } diff --git a/test/files/run/t3026.scala b/test/files/run/t3026.scala index 0231c7bcd1..22dde9cc03 100755 --- a/test/files/run/t3026.scala +++ b/test/files/run/t3026.scala @@ -3,6 +3,6 @@ object Test { case object RED extends Colour case object YELLOW extends Colour val items = Array(RED, YELLOW) - + def main(args: Array[String]): Unit = items foreach println } diff --git a/test/files/run/t3038.scala b/test/files/run/t3038.scala index 986fc982e7..7eb69f7fb5 100644 --- a/test/files/run/t3038.scala +++ b/test/files/run/t3038.scala @@ -2,18 +2,18 @@ class A { private lazy val a1 = "a1" object B private lazy val a2 = "a2" - + @transient lazy val a3 = "a3" @transient private lazy val a4 = "a4" @transient lazy val a5 = "a5" @transient private lazy val a6 = "a6" - + final val a7 = "a7" private final val a8 = "a8" @transient final val a9 = "a9" - - + + def run = { @@ -27,13 +27,13 @@ class A { println(a7) println(a8) println(a9) - } + } } class C extends A { private lazy val c1 = "c1" lazy val c2 = "c2" - + private lazy val c3 = "c3" @transient lazy val c4 = "c4" @@ -41,7 +41,7 @@ class C extends A { @transient lazy val c6 = "c6" @transient private lazy val c7 = "c7" lazy val c8 = "c8" - + final val c9 = "c9" private final val c10 = "c10" diff --git a/test/files/run/t3038c/A_1.scala b/test/files/run/t3038c/A_1.scala index 14579fcf67..91564e3021 100644 --- a/test/files/run/t3038c/A_1.scala +++ b/test/files/run/t3038c/A_1.scala @@ -59,7 +59,7 @@ class A { lazy val a57 = 58 lazy val a58 = 59 lazy val a59 = 60 - private lazy val a60 = 61 + private lazy val a60 = 61 private lazy val a61 = 62 private lazy val a62 = 63 private lazy val a63 = 64 @@ -69,7 +69,7 @@ class A { private lazy val a67 = 68 private lazy val a68 = 69 private lazy val a69 = 70 - + def run = { println(List(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, diff --git a/test/files/run/t3038d.scala b/test/files/run/t3038d.scala index 56cfcdb174..44fb047b0b 100644 --- a/test/files/run/t3038d.scala +++ b/test/files/run/t3038d.scala @@ -20,13 +20,13 @@ class Bar extends Foo with Serializable { @transient protected var first: Any = null def size = a @transient var second: Any = null - + def checkMember { if (first == null) print("") } - + private def writeObject(out: java.io.ObjectOutputStream) { serializeTo(out) } - + private def readObject(in: java.io.ObjectInputStream) { first = null init(in) @@ -38,7 +38,7 @@ object Test { val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bytes)) in.readObject.asInstanceOf[A] } - + private def toBytes(o: AnyRef): Array[Byte] = { val bos = new java.io.ByteArrayOutputStream val out = new java.io.ObjectOutputStream(bos) @@ -47,7 +47,7 @@ object Test { bos.toByteArray } - + def main(args: Array[String]) { val a1 = new Bar() val serialized:Array[Byte] = toBytes(a1) diff --git a/test/files/run/t3050.scala b/test/files/run/t3050.scala index 65b2674b69..160f8b664b 100644 --- a/test/files/run/t3050.scala +++ b/test/files/run/t3050.scala @@ -1,9 +1,9 @@ object Test { def main(args: Array[String]): Unit = { - val x = + val x = try { ("": Any) match { case List(_*) => true } } catch { case _: Throwable => false } - + assert(!x) } } diff --git a/test/files/run/t3112.scala b/test/files/run/t3112.scala index 88677fa09e..eb8eec6327 100644 --- a/test/files/run/t3112.scala +++ b/test/files/run/t3112.scala @@ -7,5 +7,5 @@ object Test { println((Vector() ++ (0 until 32)) takeRight 0) // works println((Vector() ++ (0 until 33)) takeRight 0) // error } - + }
\ No newline at end of file diff --git a/test/files/run/t3150.scala b/test/files/run/t3150.scala index 8acdb50354..034703b5f7 100644 --- a/test/files/run/t3150.scala +++ b/test/files/run/t3150.scala @@ -1,7 +1,7 @@ object Test { case object Bob { override def equals(other: Any) = true } def f(x: Any) = x match { case Bob => Bob } - + def main(args: Array[String]): Unit = { assert(f(Bob) eq Bob) assert(f(0) eq Bob) diff --git a/test/files/run/t3158.scala b/test/files/run/t3158.scala index 2261b5cd81..c824b62e96 100644 --- a/test/files/run/t3158.scala +++ b/test/files/run/t3158.scala @@ -1,6 +1,6 @@ object Test { def main(args: Array[String]) { - println(args.map(_ => foo _).deep) + println(args.map(_ => foo _).deep) } def foo(xs: String*) { diff --git a/test/files/run/t3175.scala b/test/files/run/t3175.scala index 5c6daead38..ea56ded229 100644 --- a/test/files/run/t3175.scala +++ b/test/files/run/t3175.scala @@ -9,46 +9,46 @@ object Test { def f1(x:{ def apply(x: Int): Long }) = x(0) def f2(x:{ def apply(x: Int): Byte }) = x(0) def f3(x:{ def apply(x: Int): String }) = x(0).length - + def f4(x:{ def update(x: Int, y: Long): Unit }, y: Long) = x(0) = y def f5(x:{ def update(x: Int, y: Byte): Unit }, y: Byte) = x(0) = y def f6(x:{ def update(x: Int, y: String): Unit }, y: String) = x(0) = y - + def f7(x: { def length: Any }) = x.length - + def f8(x: { def apply(x: Int): Any }) = x(0) def f9(x: { def apply(x: Int): Int }) = x(0) def f10(x: { def apply(x: Int): Long }) = x(0) - + // update has some interesting special cases def f11(x:{ def update(x: Int, y: Long): Any }, y: Long) = x(0) = y - def f12(x:{ def update(x: Int, y: String): AnyVal }, y: String) = x(0) = y + def f12(x:{ def update(x: Int, y: String): AnyVal }, y: String) = x(0) = y def f13(x:{ def update(x: Int, y: String): AnyRef }, y: String) = x(0) = y - + // doesn't work yet, see #3197 // def fclone(x:{ def clone(): AnyRef }) = x.clone() - + def main(args: Array[String]): Unit = { val longs = Array(5L) val bytes = Array(5: Byte) val strs = Array("abcde", "fghjij") - + println(len(Array(1,2,3)) + len(Array(4.0,5.0f)) + len(Array("abc", 5)) + len("bop")) println(f1(longs) + f2(bytes) + f3(strs)) - + f4(longs, 1) f5(bytes, 1) f6(strs, "a") - + println(f1(longs) + f2(bytes) + f3(strs)) - + println(f7(Array(1,2,3))) println(f7("def")) - + println(f8(Array(5))) println(f9(Array(5))) println(f10(Array(5))) - + f11(longs, 100L) f12(strs, "jabooboo") println(longs(0)) diff --git a/test/files/run/t3232.scala b/test/files/run/t3232.scala index 4c6cb1e35c..900a1f5dba 100644 --- a/test/files/run/t3232.scala +++ b/test/files/run/t3232.scala @@ -4,14 +4,14 @@ object Test { val r2 = 1 to Int.MaxValue val r3 = Int.MinValue to -2 val r4 = Int.MinValue until -1 - + // some exceptional conditions val e1 = () => (0 to Int.MaxValue).length val e2 = () => (5 until 5).last - + def main(args: Array[String]): Unit = { List(r1, r2, r3, r4) foreach (x => assert(x.length == Int.MaxValue)) - + // exception required List(e1, e2) foreach { f => try { f() ; assert(false) } diff --git a/test/files/run/t3269.scala b/test/files/run/t3269.scala index 6fe727111c..17e42cdb0e 100644 --- a/test/files/run/t3269.scala +++ b/test/files/run/t3269.scala @@ -4,6 +4,6 @@ object Test { println(it.next) it.hasNext it.hasNext - it.hasNext + it.hasNext } } diff --git a/test/files/run/t3273.scala b/test/files/run/t3273.scala index a4dfc4b30c..379a8a29c1 100644 --- a/test/files/run/t3273.scala +++ b/test/files/run/t3273.scala @@ -1,7 +1,7 @@ object Test { val num1: Stream[Int] = 1 #:: num1.map(_ + 1) val num2: Stream[Int] = 1 #:: num2.iterator.map(_ + 1).toStream - + def main(args: Array[String]): Unit = { val x1 = (num1 take 10).toList val x2 = (num2 take 10).toList diff --git a/test/files/run/t3326.scala b/test/files/run/t3326.scala index f70cb01504..4ac7ef9138 100644 --- a/test/files/run/t3326.scala +++ b/test/files/run/t3326.scala @@ -10,7 +10,7 @@ import scala.math.Ordering * * There are 2 `++` overloads - a generic one in traversables and * a map-specific one in `MapLike` - which knows about the ordering. - * + * * The problem here is that the expected return type for the expression * in which `++` appears drives the decision of the overload that needs * to be taken. @@ -18,36 +18,36 @@ import scala.math.Ordering * `SortedMap`, but `immutable.Map` instead. * This is why `collection.SortedMap` used to resort to the generic * `TraversableLike.++` which knows nothing about the ordering. - * + * * To avoid `collection.SortedMap`s resort to the more generic `TraverableLike.++`, * we override the `MapLike.++` overload in `collection.SortedMap` to return * the proper type `SortedMap`. */ object Test { - + def main(args: Array[String]) { testCollectionSorted() testImmutableSorted() } - + def testCollectionSorted() { import collection._ val order = implicitly[Ordering[Int]].reverse var m1: SortedMap[Int, String] = SortedMap.empty[Int, String](order) var m2: SortedMap[Int, String] = SortedMap.empty[Int, String](order) - + m1 += (1 -> "World") m1 += (2 -> "Hello") - + m2 += (4 -> "Bar") m2 += (5 -> "Foo") - + val m3: SortedMap[Int, String] = m1 ++ m2 - + println(m1) println(m2) println(m3) - + println(m1 + (3 -> "?")) } @@ -56,19 +56,19 @@ object Test { val order = implicitly[Ordering[Int]].reverse var m1: SortedMap[Int, String] = SortedMap.empty[Int, String](order) var m2: SortedMap[Int, String] = SortedMap.empty[Int, String](order) - + m1 += (1 -> "World") m1 += (2 -> "Hello") - + m2 += (4 -> "Bar") m2 += (5 -> "Foo") - + val m3: SortedMap[Int, String] = m1 ++ m2 - + println(m1) println(m2) println(m3) - + println(m1 + (3 -> "?")) } } diff --git a/test/files/run/t3361.scala b/test/files/run/t3361.scala index f739d17b86..d49bcbc905 100644 --- a/test/files/run/t3361.scala +++ b/test/files/run/t3361.scala @@ -40,7 +40,7 @@ object Test extends App { def insert_1 { val ten = DoubleLinkedList(1 to 10: _*) ten.append(DoubleLinkedList(11)) - + // Post-insert size test require(11 == ten.size) // Post-insert data test diff --git a/test/files/run/t3376.check b/test/files/run/t3376.check index 3a1d7d581b..cc6949d326 100644 --- a/test/files/run/t3376.check +++ b/test/files/run/t3376.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class M[@specialized T] { override def toString = "mmm" } defined class M diff --git a/test/files/run/t3395.scala b/test/files/run/t3395.scala index 01cc431871..b4990a1716 100644 --- a/test/files/run/t3395.scala +++ b/test/files/run/t3395.scala @@ -1,11 +1,11 @@ object Test { def main(args: Array[String]): Unit = { - Seq("") match { + Seq("") match { case Seq("") => println("abc") case Seq(_, _, x) => println(x) } - - Seq(1, 2, "def") match { + + Seq(1, 2, "def") match { case Seq("") => println("abc") case Seq(_, _, x) => println(x) } diff --git a/test/files/run/t3397.scala b/test/files/run/t3397.scala index 243fe766de..2c8cbed3ab 100644 --- a/test/files/run/t3397.scala +++ b/test/files/run/t3397.scala @@ -1,7 +1,7 @@ object Test { def main(args: Array[String]): Unit = { val x = Seq(Set(1,2,3),Set(4,5,6),Set(7,8,9)).transpose - + () } } diff --git a/test/files/run/t3488.scala b/test/files/run/t3488.scala index 20a1400dce..a8cfa9b808 100644 --- a/test/files/run/t3488.scala +++ b/test/files/run/t3488.scala @@ -1,6 +1,6 @@ object Test extends App { def foo(p: => Unit)(x:Int = 0) = x - + println(foo { val List(_*)=List(0); 1 } ()) println(foo { val List(_*)=List(0); 1 } (1)) } diff --git a/test/files/run/t3493.scala b/test/files/run/t3493.scala index b0b7589cfd..aafe7a3a4a 100644 --- a/test/files/run/t3493.scala +++ b/test/files/run/t3493.scala @@ -3,7 +3,7 @@ object Test { - + def main(args: Array[String]) { import scala.collection.immutable._ val x = TreeSet("a", "b", "c", "d") @@ -11,5 +11,5 @@ object Test { assert(x2.toString == "TreeSet(a, b, c, d, e)") assert(x2.toString == runtime.ScalaRunTime.stringOf(x2).trim) } - + } diff --git a/test/files/run/t3496.scala b/test/files/run/t3496.scala index 80a4e6bd86..e1aa032ab1 100644 --- a/test/files/run/t3496.scala +++ b/test/files/run/t3496.scala @@ -4,12 +4,12 @@ // ticket #3496 object Test { - + def main(args: Array[String]) { val s = Stream.from(1) s.take(5) s.drop(5) s.splitAt(5) } - + } diff --git a/test/files/run/t3502.scala b/test/files/run/t3502.scala index 9492b2d4d4..cc78e54c86 100644 --- a/test/files/run/t3502.scala +++ b/test/files/run/t3502.scala @@ -5,7 +5,7 @@ // ticket #3502 object Test { - + object GeneratePrimeFactorsLazy extends (Int => List[Int]) { override def apply(n:Int) = { val s = Stream.range(2, n / 2).filter(n % _ == 0) @@ -13,12 +13,12 @@ object Test { s.headOption.map(x => x :: apply(n / x)).getOrElse(List(n)) } } - + def main(args:Array[String]) { // a prime number //val num = 623456789 val num = 2796203 assert(GeneratePrimeFactorsLazy(num) == List(num)) } - + } diff --git a/test/files/run/t3509.scala b/test/files/run/t3509.scala index 7ec150eb01..76f8d6016e 100644 --- a/test/files/run/t3509.scala +++ b/test/files/run/t3509.scala @@ -1,7 +1,7 @@ object Test { - class Foo(final var i:Int) - + class Foo(final var i:Int) + def main(args : Array[String]) : Unit = { val foo = new Foo(0) foo.i += 1 diff --git a/test/files/run/t3511.scala b/test/files/run/t3511.scala index 9b4d581462..30757b1a66 100644 --- a/test/files/run/t3511.scala +++ b/test/files/run/t3511.scala @@ -6,31 +6,31 @@ import scala.collection.immutable._ // ticket #3511 object Test { - + def main(args: Array[String]) { assert(Stream.from(0).view.force.take(5) == List(0, 1, 2, 3, 4)) - + val s = Stream.from(0) val smap = s.view.map(_ * 2).force.take(5) assert(smap == List(0, 2, 4, 6, 8)) - + val sfilter = s.view.filter(_ % 2 == 0).force.take(5) assert(sfilter == List(0, 2, 4, 6, 8)) - + val sflatmap = s.view.flatMap(n => List(n, n * 2)).force.take(6) assert(sflatmap == List(0, 0, 1, 2, 2, 4)) - + val stakewhile = s.view.takeWhile(_ < 10).force assert(stakewhile == List.range(0, 10)) - + val szip = s.view.zip(s.map(_ / 2)).force.take(5) assert(szip == List((0, 0), (1, 0), (2, 1), (3, 1), (4, 2))) - + val szipall = s.view.zipAll(List(0, 1, 2), 0, 0).force.take(5) assert(szipall == List((0, 0), (1, 1), (2, 2), (3, 0), (4, 0))) - + val spatch = s.view.patch(1, List(5, 5, 5), 5).force.take(5) assert(spatch == List(0, 5, 5, 5, 6)) } - + } diff --git a/test/files/run/t3516.scala b/test/files/run/t3516.scala index 82a97f27de..aa302ce85a 100644 --- a/test/files/run/t3516.scala +++ b/test/files/run/t3516.scala @@ -1,7 +1,7 @@ object Test { def mkIterator = (1 to 5).iterator map (x => { println(x) ; x }) def mkInfinite = Iterator continually { println(1) ; 1 } - + def main(args: Array[String]): Unit = { // Stream is strict in its head so we should see 1 from each of them. val s1 = mkIterator.toStream diff --git a/test/files/run/t3518.scala b/test/files/run/t3518.scala index 36ca9daaa2..033cc19548 100644 --- a/test/files/run/t3518.scala +++ b/test/files/run/t3518.scala @@ -4,7 +4,7 @@ object Test { val r3 = 10.0 to 1.0 by -0.5 val r4 = 1.0 until 1.0 by 1.0 val r5 = 1 to 100 by 2 - + def main(args: Array[String]): Unit = { assert(r3 forall (r1 contains _)) assert(r1 forall (r3 contains _)) diff --git a/test/files/run/t3530.scala b/test/files/run/t3530.scala index 3fedc66dbe..f6f7fb4229 100644 --- a/test/files/run/t3530.scala +++ b/test/files/run/t3530.scala @@ -5,7 +5,7 @@ object Test { case xs @ List(_*) => "list: " + xs.length case _ => "not a list" }) - + def f2[T](x: List[T]) = println(x match { case List(_, _) => "two" case List(_, _, _) => "three" @@ -21,9 +21,9 @@ object Test { f(Nil) f(List(1,2,3,4,5)) f(null) - + println - + f2(List(1, 2)) f2(List('a', 'b', 'c')) f2(List('a', 'b', 'c', 'd')) diff --git a/test/files/run/t3540.scala b/test/files/run/t3540.scala index 4eb3de780b..5ffacb5dff 100644 --- a/test/files/run/t3540.scala +++ b/test/files/run/t3540.scala @@ -2,6 +2,6 @@ object Test { def main(args: Array[String]): Unit = { assert(List.iterate(List(1,2,3), 4)(_.tail).last.isEmpty) assert(Stream.iterate(Stream(1,2,3), 4)(_.tail).last.isEmpty) - assert(Array.iterate(Array(1,2,3), 4)(_.tail).last.isEmpty) + assert(Array.iterate(Array(1,2,3), 4)(_.tail).last.isEmpty) } } diff --git a/test/files/run/t3563.scala b/test/files/run/t3563.scala index 2a80ef412a..8abbb60803 100644 --- a/test/files/run/t3563.scala +++ b/test/files/run/t3563.scala @@ -5,17 +5,17 @@ // ticket #3563 object Test { - + def main(args: Array[String]) { var sum = 0 val setseq = Set(1, 2, 3, 4).toSeq setseq.map( n => { sum += n; n * n }).head assert(sum == 10) - + sum = 0 val mapseq = Map(1 -> 1, 2 -> 2, 3 -> 3, 4 -> 4).toSeq mapseq.map( n => { sum += n._1; (n._1 + n._1, n._2 * n._2) }).head assert(sum == 10) } - + } diff --git a/test/files/run/t3569.scala b/test/files/run/t3569.scala index 4699aeaab3..91d437e0e3 100644 --- a/test/files/run/t3569.scala +++ b/test/files/run/t3569.scala @@ -1,9 +1,9 @@ object Test { final val bippy1 = 1 final lazy val bippy2 = 2 - + lazy val lv = scala.util.Random.nextInt() - + class X(final var x: Int) { final var var1: Int = 0 final private var var2: Int = 0 @@ -12,20 +12,20 @@ object Test { final val val1: Int = 1 final private val val2: Int = 1 final private[this] val val3: Int = 1 - + final lazy val lval1: Int = 2 final private lazy val lval2: Int = 2 final private[this] lazy val lval3: Int = 2 } case class Y(final var x: Int, final private var y: Int, final val z1: Int, final private val z2: Int) { } - + def f = new X(0).x += 1 def main(args: Array[String]) { f val s = new X(0) s.x += 1 println(s.x) - + (classOf[X].getDeclaredFields map ("" + _)).sorted foreach println (classOf[Y].getDeclaredFields map ("" + _)).sorted foreach println } diff --git a/test/files/run/t3575.scala b/test/files/run/t3575.scala index 7ede65b00c..ef83e84f14 100644 --- a/test/files/run/t3575.scala +++ b/test/files/run/t3575.scala @@ -46,7 +46,7 @@ object Test { println(TwoShort(12, "Hello").getClass().getName()); println(TwoShort("Hello", 12).getClass().getName()); println(TwoShort(12, 12).getClass().getName()); - + println(TwoMinimal("Hello", "World").getClass().getName()); println(TwoMinimal(12, "Hello").getClass().getName()); println(TwoMinimal("Hello", 12).getClass().getName()); diff --git a/test/files/run/t3580.scala b/test/files/run/t3580.scala index ac9f81ab9e..50ff6c4551 100644 --- a/test/files/run/t3580.scala +++ b/test/files/run/t3580.scala @@ -4,14 +4,14 @@ object Test { - + class Empty extends Traversable[Nothing] { def foreach[U](f: Nothing => U) {} } - + def main(args: Array[String]) { val t = new Empty t.toStream } - + } diff --git a/test/files/run/t3603.scala b/test/files/run/t3603.scala index a0821a2a45..a89cb7080a 100644 --- a/test/files/run/t3603.scala +++ b/test/files/run/t3603.scala @@ -2,17 +2,17 @@ object Test { - + def main(args: Array[String]) { import collection.immutable._ - + val intmap = IntMap(1 -> 1, 2 -> 2) val intres = intmap.map { case (a, b) => (a, b.toString) } assert(intres.isInstanceOf[IntMap[_]]) - + val longmap = LongMap(1L -> 1, 2L -> 2) val longres = longmap.map { case (a, b) => (a, b.toString) } assert(longres.isInstanceOf[LongMap[_]]) } - + } diff --git a/test/files/run/t3613.scala b/test/files/run/t3613.scala index 171a6a21aa..1293f62c0f 100644 --- a/test/files/run/t3613.scala +++ b/test/files/run/t3613.scala @@ -1,7 +1,7 @@ class Boopy { private val s = new Schnuck def observer : PartialFunction[ Any, Unit ] = s.observer - + private class Schnuck extends javax.swing.AbstractListModel { model => val observer : PartialFunction[ Any, Unit ] = { @@ -10,13 +10,13 @@ class Boopy { def getSize = 0 def getElementAt( idx: Int ) = ??? } - + } object Test { def main(args: Array[String]): Unit = { val x = new Boopy val o = x.observer - o( "Boopy" ) // --> throws runtime error + o( "Boopy" ) // --> throws runtime error } } diff --git a/test/files/run/t3619.scala b/test/files/run/t3619.scala index 46324b4d69..3f4c56ea53 100644 --- a/test/files/run/t3619.scala +++ b/test/files/run/t3619.scala @@ -17,7 +17,7 @@ object Test extends App { } } */ - + new Meh } diff --git a/test/files/run/t363.scala b/test/files/run/t363.scala index 5f3f30a098..c747be2ec9 100644 --- a/test/files/run/t363.scala +++ b/test/files/run/t363.scala @@ -3,7 +3,7 @@ object Test { println("I love the smell of (Array[String])Unit in the morning.") } } - + class Test { def kurtz() = "We must kill them. We must incinerate them." } diff --git a/test/files/run/t3647.scala b/test/files/run/t3647.scala index 434a13f414..a970e887f6 100644 --- a/test/files/run/t3647.scala +++ b/test/files/run/t3647.scala @@ -13,10 +13,10 @@ object Test { "line4" ).iterator) assert(ps.filter(_ == '\n').size == 3) - + val ps1 = PagedSeq.fromLines(List("Ok").iterator) assert(ps1.filter(_ == '\n').size == 0) - + val eps = PagedSeq.fromLines(List().iterator) assert(eps.filter(_ == '\n').size == 0) } diff --git a/test/files/run/t3702.scala b/test/files/run/t3702.scala index 021abcb625..0cdafd90b6 100644 --- a/test/files/run/t3702.scala +++ b/test/files/run/t3702.scala @@ -3,7 +3,7 @@ object Test { case 5 :: _ => () case List(from) => from } - + def main(args: Array[String]): Unit = { println(foo(5 :: Nil, List(1,2,3))) println(foo(6 :: Nil, List(1,2,3))) diff --git a/test/files/run/t3714.scala b/test/files/run/t3714.scala index c344b40f1f..2d600f97f1 100644 --- a/test/files/run/t3714.scala +++ b/test/files/run/t3714.scala @@ -21,7 +21,7 @@ object Test { case BreakImpl(x) => x case _ => -1 } - + def main(args: Array[String]) { val break = BreakImpl(22) // assert(f1(break) == 22) diff --git a/test/files/run/t3719.scala b/test/files/run/t3719.scala index 4649f11bb1..01dc205545 100644 --- a/test/files/run/t3719.scala +++ b/test/files/run/t3719.scala @@ -1,7 +1,7 @@ object Days extends Enumeration { type Day = DayValue val Mon, Tue, Wed, Thu, Fri, Sat, Sun = new DayValue // DayValue - + protected class DayValue extends Val { def isWeekday: Boolean = this match { @@ -21,7 +21,7 @@ object Test extends App { val d: Day = Mon d.toString } - + def nameOfTue(): String = { import Days._ val d: Day = Tue diff --git a/test/files/run/t3822.scala b/test/files/run/t3822.scala index eaf0a145d3..c35804035e 100644 --- a/test/files/run/t3822.scala +++ b/test/files/run/t3822.scala @@ -1,17 +1,17 @@ import scala.collection.{ mutable, immutable, generic } import immutable.ListSet -object Test { +object Test { def main(args: Array[String]): Unit = { val xs = ListSet(-100000 to 100001: _*) - + assert(xs.size == 200002) assert(xs.sum == 100001) - + val ys = ListSet[Int]() val ys1 = (1 to 12).grouped(3).foldLeft(ys)(_ ++ _) val ys2 = (1 to 12).foldLeft(ys)(_ + _) - + assert(ys1 == ys2) } } diff --git a/test/files/run/t3829.scala b/test/files/run/t3829.scala index e3d8c56882..780a6a95b7 100644 --- a/test/files/run/t3829.scala +++ b/test/files/run/t3829.scala @@ -1,11 +1,11 @@ // ticket #3829 object Test { import collection.{ mutable, immutable } - + def main(args: Array[String]) { val map = immutable.Map(1 -> 2, 3 -> 4) assert(map.get(0) == None) - + // Since r24255 defaultMap.get(x) returns None rather than // using the default, so these mostly use apply. val defmap = map.withDefaultValue(-1) @@ -19,10 +19,10 @@ object Test { assert((defmap - 1)(0) == -1) assert((defmap - 1)(1) == -1) assert((defmap - 1)(3) == 4) - + val mutmap = mutable.Map(1 -> 2, 2 -> 3) assert(mutmap.get(0) == None) - + val defmutmap = mutmap.withDefaultValue(-1) assert(defmutmap(0) == -1) assert(defmutmap(3) == -1) @@ -36,5 +36,5 @@ object Test { assert(defmutmap(1) == 2) assert(mutmap(1) == 2) } - + } diff --git a/test/files/run/t3855.scala b/test/files/run/t3855.scala index d8029e16f0..d10aab5383 100644 --- a/test/files/run/t3855.scala +++ b/test/files/run/t3855.scala @@ -1,7 +1,7 @@ object Test { def byval[A](a: => A) = a def closure[A](f: () => A) = f() - + def f1(s: String) = { var n = try { s.toInt } catch { case _: Throwable => 1 } byval(n) diff --git a/test/files/run/t3877.scala b/test/files/run/t3877.scala index ce1e9283a7..5710e982a0 100644 --- a/test/files/run/t3877.scala +++ b/test/files/run/t3877.scala @@ -11,7 +11,7 @@ object Test { println("test1: " + d) } } - + def test2 { var d = 2 var i = 0 @@ -25,7 +25,7 @@ object Test { return } } - + def test3 { var d = 2 var i = 0 @@ -34,9 +34,9 @@ object Test { d = b i += 1 println("test3: " + d) - } while (d < LIMIT && i < LIMIT) + } while (d < LIMIT && i < LIMIT) } - + def test4 { var d = 2 var i = 0 @@ -47,9 +47,9 @@ object Test { println("test4: " + d) if (d >= LIMIT || i >= LIMIT) return - } while (true) + } while (true) } - + def test5 { var d = 2 var i = 0 @@ -58,7 +58,7 @@ object Test { d = b i += 1 println("test5.1: " + d) - + var e = 2 var j = 0 while (e < LIMIT && j < LIMIT) { @@ -69,7 +69,7 @@ object Test { } } } - + def main(args: Array[String]) { test1 diff --git a/test/files/run/t3887.scala b/test/files/run/t3887.scala index 81fa7a917e..16ce983efc 100644 --- a/test/files/run/t3887.scala +++ b/test/files/run/t3887.scala @@ -13,4 +13,4 @@ object Test { val option1: (Int, String) = (1, "abc") -} +} diff --git a/test/files/run/t3888.scala b/test/files/run/t3888.scala index 1914072599..19771041fc 100644 --- a/test/files/run/t3888.scala +++ b/test/files/run/t3888.scala @@ -6,13 +6,13 @@ object Test { val T1 = new P private[this] val T2 = T1 - def m1 = + def m1 = (1, 2) match { case T1 => true case _ => false } - def m2 = + def m2 = (1, 2) match { case T2 => true case _ => false diff --git a/test/files/run/t3897/J_2.java b/test/files/run/t3897/J_2.java index 178412dc92..a4c9a98fb1 100644 --- a/test/files/run/t3897/J_2.java +++ b/test/files/run/t3897/J_2.java @@ -7,7 +7,7 @@ public class J_2 { String name = fields[i].getName(); if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { } else System.out.println("(" + name + "," + fields[i].getGenericType() + ")"); - } + } } public void f2(Class<?> clazz) { Method[] methods = clazz.getDeclaredMethods(); @@ -15,7 +15,7 @@ public class J_2 { String name = methods[i].getName(); if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { } else System.out.println("(" + name + "," + methods[i].getGenericReturnType() + ")"); - } + } } public void javaRun() { diff --git a/test/files/run/t3897/a_2.scala b/test/files/run/t3897/a_2.scala index 4d9e59ef05..7a161fcbe4 100644 --- a/test/files/run/t3897/a_2.scala +++ b/test/files/run/t3897/a_2.scala @@ -1,12 +1,12 @@ object Test { def f1(clazz: Class[_]) = ( - clazz.getDeclaredFields.toList + clazz.getDeclaredFields.toList . filterNot (_.getName contains "bitmap$") . map (f => (f.getName, f.getGenericType)) . foreach (println) ) def f2(clazz: Class[_]) = ( - clazz.getDeclaredMethods.toList + clazz.getDeclaredMethods.toList . filterNot (_.getName contains "bitmap$") . map (f => (f.getName, f.getGenericReturnType)) . foreach (println) @@ -17,7 +17,7 @@ object Test { f2(classOf[One]) f1(classOf[Two]) f2(classOf[Two]) - + new J_2().javaRun } } diff --git a/test/files/run/t3932.scala b/test/files/run/t3932.scala index 51fc16d6ea..f577ef8315 100644 --- a/test/files/run/t3932.scala +++ b/test/files/run/t3932.scala @@ -23,10 +23,10 @@ object Test { def main(args: Array[String]): Unit = { println(O1.g1) println(O1.g2) - + println(O2.g1) println(O2.g2) - + val o3 = new O3() println(o3.g1) println(o3.g2) diff --git a/test/files/run/t3964.scala b/test/files/run/t3964.scala index 68ff9a44c4..9b46cdb298 100644 --- a/test/files/run/t3964.scala +++ b/test/files/run/t3964.scala @@ -2,15 +2,15 @@ import scala.language.implicitConversions object Test { - class Base + class Base object Bob extends Base class Foo { def bippy = 42 } class Oof { def bippy = -21 } - + // I am more specific than you implicit def f1(x: Bob.type): Foo = new Foo implicit def f2(x: Base): Oof = new Oof - + def main(args: Array[String]): Unit = { // this would of course print an unambiguous 42 println(Bob.bippy) diff --git a/test/files/run/t3970.scala b/test/files/run/t3970.scala index f8c763bc85..35b5ce6e1b 100644 --- a/test/files/run/t3970.scala +++ b/test/files/run/t3970.scala @@ -9,11 +9,11 @@ object Test { def main(args: Array[String]) { val dl = DoubleLinkedList[Int]() dl.remove() - + val dl2 = DoubleLinkedList[Int](1, 2, 3) dl2.next.remove() assert(dl2 == DoubleLinkedList(1, 3)) - + val dl3 = DoubleLinkedList[Int](1, 2, 3) assert(dl3.drop(1) == DoubleLinkedList(2, 3)) assert(dl3.drop(1).prev == null) diff --git a/test/files/run/t3980.scala b/test/files/run/t3980.scala index 4e693eba9b..c140176ce4 100644 --- a/test/files/run/t3980.scala +++ b/test/files/run/t3980.scala @@ -2,7 +2,7 @@ object A { def run1 { lazy val x: Unit = {(); println("once")} x - x + x } def run2 { lazy val y: Int = 2 diff --git a/test/files/run/t3984.scala b/test/files/run/t3984.scala index 9a2e00a2a8..0747b0ee25 100644 --- a/test/files/run/t3984.scala +++ b/test/files/run/t3984.scala @@ -36,7 +36,7 @@ object MapBug { im = im + ((ih,ih)) mm = mm + ((ih,ih)) } - assert(im == mm) + assert(im == mm) val x = IH(6,4) im = im - x mm = mm - x diff --git a/test/files/run/t4013.scala b/test/files/run/t4013.scala index da7fbc5b3f..7060559317 100644 --- a/test/files/run/t4013.scala +++ b/test/files/run/t4013.scala @@ -5,12 +5,12 @@ trait Base[B] { } -class Suba[@specialized B](override val data: Array[B]) extends Base[B] { +class Suba[@specialized B](override val data: Array[B]) extends Base[B] { assert(data != null) } -class Subopt[@specialized B](override val data: Option[B]) extends Base[B] { +class Subopt[@specialized B](override val data: Option[B]) extends Base[B] { assert(data != null) } diff --git a/test/files/run/t4013b.scala b/test/files/run/t4013b.scala index f17eaea3d3..1262e261f5 100644 --- a/test/files/run/t4013b.scala +++ b/test/files/run/t4013b.scala @@ -8,7 +8,7 @@ trait Base[B] { class M[@specialized(Int) A] -class Sub3[@specialized(Int) B](override val data: M[B]) extends Base[B] { +class Sub3[@specialized(Int) B](override val data: M[B]) extends Base[B] { assert(data != null) } diff --git a/test/files/run/t4023.scala b/test/files/run/t4023.scala index 38190cfa5c..518b58382a 100644 --- a/test/files/run/t4023.scala +++ b/test/files/run/t4023.scala @@ -5,8 +5,8 @@ object Test { object B3 private object B4 object B5 extends B1 - private object B6 extends B2 - + private object B6 extends B2 + val classes1 = this.getClass.getDeclaredClasses val classes2 = C.getClass .getDeclaredClasses val classes3 = getClass .getDeclaredClasses @@ -19,7 +19,7 @@ object Test { val valuesTry2 = C.classes2.sortBy(_.getName) val valuesTry3 = C.classes3.sortBy(_.getName) } - + def main(args: Array[String]) { println("Try 1: (" + TestHelper.valuesTry1.length + " classes)") TestHelper.valuesTry1.foreach(println) diff --git a/test/files/run/t4024.scala b/test/files/run/t4024.scala index 7c62a3fc6e..f48410915d 100644 --- a/test/files/run/t4024.scala +++ b/test/files/run/t4024.scala @@ -1,9 +1,9 @@ object Test extends App { - val x = "abc" + val x = "abc" val m = x.getClass.getMethod("toString") - + assert(m.invoke(x, (Nil: List[AnyRef]): _*) == "abc") Test2.main(Array()) diff --git a/test/files/run/t4025.check b/test/files/run/t4025.check index 6715003cb6..2d4f644c5a 100644 --- a/test/files/run/t4025.check +++ b/test/files/run/t4025.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class Color(val red: Int) defined class Color diff --git a/test/files/run/t4027.scala b/test/files/run/t4027.scala index d70ca0cc3a..585c5c8b37 100644 --- a/test/files/run/t4027.scala +++ b/test/files/run/t4027.scala @@ -7,7 +7,7 @@ import collection._ * Mapping, filtering, etc. on these views should return sorted maps again. */ object Test extends App { - + val sortedmap = SortedMap(1 -> false, 2 -> true, 3 -> false, 4 -> true) println(sortedmap.filterKeys(_ % 2 == 0): SortedMap[Int, Boolean]) println(sortedmap.mapValues(_ + "!"): SortedMap[Int, String]) @@ -15,7 +15,7 @@ object Test extends App { println(sortedmap.mapValues(_ + "!").map(t => (t._1, t._2.toString.length)): SortedMap[Int, Int]) println(sortedmap.filterKeys(_ % 2 == 0).filter(t => t._1 < 2): SortedMap[Int, Boolean]) println(sortedmap.mapValues(_ + "!").filter(t => t._1 < 2): SortedMap[Int, String]) - + val immsortedmap = immutable.SortedMap(1 -> false, 2 -> true, 3 -> false, 4 -> true) println(immsortedmap.filterKeys(_ % 2 == 0): immutable.SortedMap[Int, Boolean]) println(immsortedmap.mapValues(_ + "!"): immutable.SortedMap[Int, String]) @@ -23,5 +23,5 @@ object Test extends App { println(immsortedmap.mapValues(_ + "!").map(t => (t._1, t._2.toString.length)): immutable.SortedMap[Int, Int]) println(immsortedmap.filterKeys(_ % 2 == 0).filter(t => t._1 < 2): immutable.SortedMap[Int, Boolean]) println(immsortedmap.mapValues(_ + "!").filter(t => t._1 < 2): immutable.SortedMap[Int, String]) - + } diff --git a/test/files/run/t4054.scala b/test/files/run/t4054.scala index 8f1f685854..83a58ef97c 100644 --- a/test/files/run/t4054.scala +++ b/test/files/run/t4054.scala @@ -9,7 +9,7 @@ object Test { def main(args: Array[String]) { val it = Iterator.from(1).map(n => n * n).scanLeft(0)(_+_) - + assert(it.next == 0) assert(it.next == 1) assert(it.next == 5) diff --git a/test/files/run/t4062.scala b/test/files/run/t4062.scala index 6a5aea5b47..f5478e7593 100644 --- a/test/files/run/t4062.scala +++ b/test/files/run/t4062.scala @@ -1,7 +1,7 @@ class A(val f : String) class B(f: String) extends A(f) { - def foo(x: String) = x match { + def foo(x: String) = x match { case `f` => true case _ => false } diff --git a/test/files/run/t4072.scala b/test/files/run/t4072.scala index bff2e0c7d2..c035fcc22a 100644 --- a/test/files/run/t4072.scala +++ b/test/files/run/t4072.scala @@ -4,11 +4,11 @@ import scala.language.{ reflectiveCalls } object Test { class DryRun { - val compiler = new Global(new Settings()) { + val compiler = new Global(new Settings()) { lazy val test1 = new AnyRef } } - + def main(args: Array[String]) { new DryRun().compiler.test1 } diff --git a/test/files/run/t408.scala b/test/files/run/t408.scala index 4d3dcbcb84..9e51e881ed 100644 --- a/test/files/run/t408.scala +++ b/test/files/run/t408.scala @@ -2,7 +2,7 @@ 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 diff --git a/test/files/run/t4119/J.java b/test/files/run/t4119/J.java index 42508993ea..ee65d33e22 100644 --- a/test/files/run/t4119/J.java +++ b/test/files/run/t4119/J.java @@ -1,6 +1,6 @@ package foo.bar; -public abstract class J { +public abstract class J { protected void foo(J j) { return; } diff --git a/test/files/run/t4119/S.scala b/test/files/run/t4119/S.scala index e5e3db5da3..d6ae5f1b87 100644 --- a/test/files/run/t4119/S.scala +++ b/test/files/run/t4119/S.scala @@ -1,6 +1,6 @@ class S extends foo.bar.J { sss => - + val fn = () => { foo(S.this) } diff --git a/test/files/run/t4122.scala b/test/files/run/t4122.scala index 7ead2b7742..5ff570c009 100644 --- a/test/files/run/t4122.scala +++ b/test/files/run/t4122.scala @@ -4,7 +4,7 @@ object Test { val sw3 = Seq('a', 'b') val sw4 = "ab".toList val all = List(sw, sw2, sw3, sw4) - + def main(args: Array[String]): Unit = { for (s1 <- all ; s2 <- all) { assert(s1 == s2, s1 + " != " + s2) diff --git a/test/files/run/t4148.scala b/test/files/run/t4148.scala index 6de0c8fe7a..d543e093ab 100644 --- a/test/files/run/t4148.scala +++ b/test/files/run/t4148.scala @@ -2,7 +2,7 @@ object Test { val x1 = try { "aaa".asInstanceOf[Int] } catch { case _: Throwable => "cce1" } val x2 = try { (5: Any).asInstanceOf[Int] } catch { case _: Throwable => "cce2" } val x3 = try { (new java.lang.Short(100.toShort).asInstanceOf[Int]) } catch { case _: Throwable => "cce3" } - + def main(args: Array[String]): Unit = { List(x1, x2, x3) foreach println } diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check index b48c9ca056..d94638d27e 100644 --- a/test/files/run/t4172.check +++ b/test/files/run/t4172.check @@ -1,12 +1,8 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) } +scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) } warning: there were 1 feature warning(s); re-run with -feature for details c: (C, C{def f: Int}) forSome { type C <: AnyRef } = (C,C) scala> - -scala> diff --git a/test/files/run/t4238/J_1.java b/test/files/run/t4238/J_1.java index 21a4b182ad..47a9c21000 100644 --- a/test/files/run/t4238/J_1.java +++ b/test/files/run/t4238/J_1.java @@ -3,14 +3,14 @@ import scala.*; class J_1 { scala.collection.mutable.HashMap<String, String> map = new scala.collection.mutable.HashMap<String, String>(); - + Function1<Tuple2<String, String>, Integer> f = new scala.runtime.AbstractFunction1<Tuple2<String, String>, Integer>() { public Integer apply(Tuple2<String, String> s) { return s._1().length(); } }; - + scala.collection.Seq<Integer> counts = map.groupBy(f).keys().toList(); } diff --git a/test/files/run/t4285.check b/test/files/run/t4285.check index 84f8929e43..314c8e5a35 100644 --- a/test/files/run/t4285.check +++ b/test/files/run/t4285.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> val x = Array(1,2,3,4,5,6,7) x: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7) @@ -13,5 +11,3 @@ scala> println(y.sum) 56 scala> - -scala> diff --git a/test/files/run/t4288.scala b/test/files/run/t4288.scala index eafd2808f1..4e7b366f60 100644 --- a/test/files/run/t4288.scala +++ b/test/files/run/t4288.scala @@ -6,7 +6,7 @@ object Test { def f5 = (1 to 9).toArray.slice(-5, -1) def f6 = (1 to 9).toStream.slice(-5, -1) def f7 = (1 to 9).slice(-5, -1) - + def main(args: Array[String]): Unit = { List[Traversable[Int]](f1, f2, f3, f4, f5, f6, f7) foreach (x => assert(x.isEmpty, x)) } diff --git a/test/files/run/t4317/S_3.scala b/test/files/run/t4317/S_3.scala index dd04ea31ef..ce8e2330e3 100644 --- a/test/files/run/t4317/S_3.scala +++ b/test/files/run/t4317/S_3.scala @@ -1,4 +1,4 @@ -object Test { +object Test { def main(args: Array[String]): Unit = { val j = new J_2() println(j.bar1()) diff --git a/test/files/run/t4396.scala b/test/files/run/t4396.scala index ca143165b7..d67eaa378e 100644 --- a/test/files/run/t4396.scala +++ b/test/files/run/t4396.scala @@ -1,4 +1,4 @@ -// #43896 +// #43896 trait M extends DelayedInit { def delayedInit(body : => Unit) { println("hallo") diff --git a/test/files/run/t4426.scala b/test/files/run/t4426.scala index 95759444d6..1cbd42da25 100644 --- a/test/files/run/t4426.scala +++ b/test/files/run/t4426.scala @@ -5,7 +5,7 @@ object Test { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") - object cc extends Global(settings) { + object cc extends Global(settings) { object dummy override def computePluginPhases() = { @@ -16,9 +16,9 @@ object Test { new cc.Run () } - + def main(args: Array[String]): Unit = { - + } } diff --git a/test/files/run/t4461.scala b/test/files/run/t4461.scala index adc9201313..1801a653e7 100644 --- a/test/files/run/t4461.scala +++ b/test/files/run/t4461.scala @@ -9,7 +9,7 @@ object Test { buf.subscribe(new Subscriber[Message[Int], ObservableBuffer[Int]] { def notify(pub: ObservableBuffer[Int], event: Message[Int]) = println(event) }) - + buf += 1 // works buf ++= Array(2) // works buf ++= ArrayBuffer(3, 4) // works diff --git a/test/files/run/t4535.scala b/test/files/run/t4535.scala index eba79431c9..91c13a28cd 100644 --- a/test/files/run/t4535.scala +++ b/test/files/run/t4535.scala @@ -5,26 +5,26 @@ import collection._ // #4535 object Test { - + def main(args: Array[String]) { val as = new mutable.ArrayStack[Int] as push 1 as push 2 as push 3 println(as.reverse) - + as push 4 as push 5 as push 6 println(as.reverse) - + println(as map { x => x }) - + for (i <- 0 until 100) { as push i assert(as == as.map(x => x)) assert(as == as.reverse.reverse) } } - + } diff --git a/test/files/run/t4536.scala b/test/files/run/t4536.scala index acd91deb7f..6661eae6a7 100644 --- a/test/files/run/t4536.scala +++ b/test/files/run/t4536.scala @@ -37,10 +37,10 @@ object dynamicMixin extends dynamicAbstractClass with dynamicTrait { object Test { - + def main(args: Array[String]) { val cls = new dynamicClass dynamicMixin } - + } diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check index cd7a2905e2..5a8108dcbc 100644 --- a/test/files/run/t4542.check +++ b/test/files/run/t4542.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> @deprecated("foooo", "ReplTest version 1.0-FINAL") class Foo() { override def toString = "Bippy" } @@ -18,5 +16,3 @@ scala> val f = new Foo f: Foo = Bippy scala> - -scala> diff --git a/test/files/run/t4570.scala b/test/files/run/t4570.scala index 5408caf6db..5e1a20c52d 100644 --- a/test/files/run/t4570.scala +++ b/test/files/run/t4570.scala @@ -1,8 +1,8 @@ object Test extends Enumeration { val foo = Value def bar = withName("foo") - + def main(args: Array[String]): Unit = { - values foreach println + values foreach println } } diff --git a/test/files/run/t4608.scala b/test/files/run/t4608.scala index 2d43bebd10..9ffcb0f3f1 100644 --- a/test/files/run/t4608.scala +++ b/test/files/run/t4608.scala @@ -1,8 +1,8 @@ // #4608 object Test { - + def main(args: Array[String]) { ((1 to 100) sliding 10).toList.par.map{_.map{i => i * i}}.flatten } - + } diff --git a/test/files/run/t4617.scala b/test/files/run/t4617.scala index 3a877c1915..2fea5e29ec 100644 --- a/test/files/run/t4617.scala +++ b/test/files/run/t4617.scala @@ -3,7 +3,7 @@ object Test { def f2 = { lazy val d = 4D lazy val f = 4f - + def bar = "Str " + (d + f) bar } diff --git a/test/files/run/t4656.scala b/test/files/run/t4656.scala index ab3e3cf53d..4f3d189c8f 100644 --- a/test/files/run/t4656.scala +++ b/test/files/run/t4656.scala @@ -6,7 +6,7 @@ object Test { buf prependToList List(4, 5, 6) l } - + def main(args: Array[String]): Unit = { println(f) } diff --git a/test/files/run/t4671.check b/test/files/run/t4671.check index d4f8af480a..0c36083759 100644 --- a/test/files/run/t4671.check +++ b/test/files/run/t4671.check @@ -10,7 +10,7 @@ s: scala.io.BufferedSource = non-empty iterator scala> println(s.getLines.mkString("\n")) import scala.tools.partest.ReplTest -object Test extends ReplTest { +object Test extends ReplTest { // My god...it's full of quines def code = """ object o { val file = sys.props("partest.cwd") + "/t4671.scala" } @@ -30,7 +30,7 @@ s: scala.io.BufferedSource = non-empty iterator scala> println(s.mkString("")) import scala.tools.partest.ReplTest -object Test extends ReplTest { +object Test extends ReplTest { // My god...it's full of quines def code = """ object o { val file = sys.props("partest.cwd") + "/t4671.scala" } diff --git a/test/files/run/t4671.scala b/test/files/run/t4671.scala index aba0138aad..6170104c33 100644 --- a/test/files/run/t4671.scala +++ b/test/files/run/t4671.scala @@ -1,6 +1,6 @@ import scala.tools.partest.ReplTest -object Test extends ReplTest { +object Test extends ReplTest { // My god...it's full of quines def code = """ object o { val file = sys.props("partest.cwd") + "/t4671.scala" } diff --git a/test/files/run/t4680.scala b/test/files/run/t4680.scala index 88611df7ae..d5c8d0e7af 100644 --- a/test/files/run/t4680.scala +++ b/test/files/run/t4680.scala @@ -43,13 +43,13 @@ class E() extends D() { object Test { def p(msg: String) = println("\n\n// " + msg) - + def main(args: Array[String]) { p("new C { }") new C { } p("new C { 5 }") new C { 5 } - + p("new D()") new D() p("new D() { }") diff --git a/test/files/run/t4697.scala b/test/files/run/t4697.scala index 728d095ff8..95592172e0 100644 --- a/test/files/run/t4697.scala +++ b/test/files/run/t4697.scala @@ -1,7 +1,7 @@ object Test { var st = Stream(0) for (i <- 1 to 10000) st = i +: st - + def main(args: Array[String]): Unit = { println(st.take(10000).sum) } diff --git a/test/files/run/t4752.scala b/test/files/run/t4752.scala index 2a9fc5361f..3d5c166a7a 100644 --- a/test/files/run/t4752.scala +++ b/test/files/run/t4752.scala @@ -2,8 +2,8 @@ object Test { object Bippy { case object Dingus } - - def main(args: Array[String]): Unit = { + + def main(args: Array[String]): Unit = { assert(None.## == "None".##, None) assert(Test.Bippy.Dingus.## == "Dingus".##, Test.Bippy.Dingus) } diff --git a/test/files/run/t4753.scala b/test/files/run/t4753.scala index 98f3e92678..cfb252cbe5 100644 --- a/test/files/run/t4753.scala +++ b/test/files/run/t4753.scala @@ -1,4 +1,4 @@ -trait A { +trait A { val actualType: Class[_] } trait B extends A { diff --git a/test/files/run/t4761.scala b/test/files/run/t4761.scala index a9c245d7d5..e4bd87cb15 100644 --- a/test/files/run/t4761.scala +++ b/test/files/run/t4761.scala @@ -3,7 +3,7 @@ object Test { val gs = for (x <- (1 to 5)) yield { if (x % 2 == 0) List(1).seq else List(1).par } println(gs.flatten) println(gs.transpose) - + val s = Stream(Vector(1).par, Vector(2).par) println(s.flatten.toList) println(s.transpose.map(_.toList).toList) diff --git a/test/files/run/t4809.scala b/test/files/run/t4809.scala index b30d80562f..4b721d111b 100644 --- a/test/files/run/t4809.scala +++ b/test/files/run/t4809.scala @@ -5,7 +5,7 @@ import scala.util.control.Breaks._ object Test { - + def main(args: Array[String]) { val x = tryBreakable { break @@ -14,14 +14,14 @@ object Test { 3 } assert(x == 3, x) - + val y = tryBreakable { 2 } catchBreak { 3 } assert(y == 2, y) - + val z = tryBreakable { break 1.0 @@ -30,5 +30,5 @@ object Test { } assert(z == 2.0, z) } - + } diff --git a/test/files/run/t4835.scala b/test/files/run/t4835.scala index c964e42e7c..26275c0ab4 100644 --- a/test/files/run/t4835.scala +++ b/test/files/run/t4835.scala @@ -1,6 +1,6 @@ /* * Test case for SI-4835. This tests confirm that the fix - * doesn't break laziness. To test memory consumption, + * doesn't break laziness. To test memory consumption, * I need to confirm that OutOfMemoryError doesn't occur. * I could create such tests. However, such tests consume * too much time and memory. diff --git a/test/files/run/t4871.scala b/test/files/run/t4871.scala index 70d8b7145c..e25d5c1387 100644 --- a/test/files/run/t4871.scala +++ b/test/files/run/t4871.scala @@ -5,7 +5,7 @@ object Test { def main(args: Array[String]): Unit = { val z: Class[C] = classOf val z2: Class[D] = classOf[D] - + println(z) println(z2) } diff --git a/test/files/run/t4894.scala b/test/files/run/t4894.scala index aa3b4340af..2b70da141d 100644 --- a/test/files/run/t4894.scala +++ b/test/files/run/t4894.scala @@ -4,24 +4,24 @@ object Test { - + def main(args: Array[String]) { import collection._ val hs = mutable.HashSet[Int]() hs ++= 1 to 10 hs --= 1 to 10 - + val phs = parallel.mutable.ParHashSet[Int]() phs ++= 1 to 10 for (i <- 1 to 10) assert(phs(i)) phs --= 1 to 10 assert(phs.isEmpty) - + val phm = parallel.mutable.ParHashMap[Int, Int]() phm ++= ((1 to 10) zip (1 to 10)) for (i <- 1 to 10) assert(phm(i) == i) phm --= 1 to 10 assert(phm.isEmpty) } - + } diff --git a/test/files/run/t4895.scala b/test/files/run/t4895.scala index a0e8c19f00..3842f8a389 100644 --- a/test/files/run/t4895.scala +++ b/test/files/run/t4895.scala @@ -1,16 +1,16 @@ object Test { - + def checkPar(sz: Int) { import collection._ val hs = mutable.HashSet[Int]() ++ (1 to sz) assert(hs.par.map(_ + 1).seq.toSeq.sorted == (2 to (sz + 1))) } - + def main(args: Array[String]) { for (i <- 0 until 100) checkPar(i) for (i <- 100 until 1000 by 50) checkPar(i) for (i <- 1000 until 10000 by 500) checkPar(i) for (i <- 10000 until 100000 by 5000) checkPar(i) } - + } diff --git a/test/files/run/t4954.scala b/test/files/run/t4954.scala index b4916e651d..f0bb1cc02d 100644 --- a/test/files/run/t4954.scala +++ b/test/files/run/t4954.scala @@ -4,7 +4,7 @@ import collection._ object Test { - + def main(args: Array[String]) { val m = scala.collection.mutable.LinkedHashMap("one" -> 1, "two" -> 2, "three" -> 3, "four" -> 4, "five" -> 5) val expected = List("one", "two", "three", "four", "five") @@ -15,7 +15,7 @@ object Test { assert(m.keys.drop(3).iterator.toList == expected.drop(3)) assert(m.keys.drop(4).iterator.toList == expected.drop(4)) assert(m.keys.drop(5).iterator.toList == expected.drop(5)) - + val expvals = List(1, 2, 3, 4, 5) assert(m.values.iterator.toList == expvals) assert(m.values.drop(0).iterator.toList == expvals) @@ -24,7 +24,7 @@ object Test { assert(m.values.drop(3).iterator.toList == expvals.drop(3)) assert(m.values.drop(4).iterator.toList == expvals.drop(4)) assert(m.values.drop(5).iterator.toList == expvals.drop(5)) - + val pred = (x: String) => x.length < 6 val filtered = m.filterKeys(pred) assert(filtered.drop(0).keys.toList == expected.filter(pred)) @@ -32,7 +32,7 @@ object Test { assert(filtered.drop(2).keys.toList == expected.filter(pred).drop(2)) assert(filtered.drop(3).keys.toList == expected.filter(pred).drop(3)) assert(filtered.drop(4).keys.toList == expected.filter(pred).drop(4)) - + val mapped = m.mapValues(-_) assert(mapped.drop(0).keys.toList == expected) assert(mapped.drop(1).keys.toList == expected.drop(1)) @@ -41,5 +41,5 @@ object Test { assert(mapped.drop(4).keys.toList == expected.drop(4)) assert(mapped.drop(5).keys.toList == expected.drop(5)) } - + } diff --git a/test/files/run/t4996.scala b/test/files/run/t4996.scala index 8e7636aaac..8a38e7fe7f 100644 --- a/test/files/run/t4996.scala +++ b/test/files/run/t4996.scala @@ -20,7 +20,7 @@ trait M extends B { abstract override def foo(t: Int) { super.foo(t) println("M.foo") - } + } } diff --git a/test/files/run/t5018.scala b/test/files/run/t5018.scala index bb67a252e5..70bd6c52ea 100644 --- a/test/files/run/t5018.scala +++ b/test/files/run/t5018.scala @@ -7,7 +7,7 @@ import collection._ object Test { - + def serializeDeserialize[T <: AnyRef](obj: T) = { val buffer = new ByteArrayOutputStream val out = new ObjectOutputStream(buffer) @@ -15,23 +15,23 @@ object Test { val in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray)) in.readObject.asInstanceOf[T] } - + def main(args: Array[String]) { val values = mutable.Map(1 -> 1).values assert(serializeDeserialize(values).toList == values.toList) - + val keyset = mutable.Map(1 -> 1).keySet assert(serializeDeserialize(keyset) == keyset) - + val imkeyset = immutable.Map(1 -> 1).keySet assert(serializeDeserialize(imkeyset) == imkeyset) - + val defaultmap = immutable.Map(1 -> 1).withDefaultValue(1) assert(serializeDeserialize(defaultmap) == defaultmap) - + val minusmap = mutable.Map(1 -> 1).withDefault(x => -x) assert(serializeDeserialize(minusmap) == minusmap) } - + } diff --git a/test/files/run/t5053.scala b/test/files/run/t5053.scala index 233edf6780..50057ce66c 100644 --- a/test/files/run/t5053.scala +++ b/test/files/run/t5053.scala @@ -6,18 +6,18 @@ object Test extends App { val (left, right) = Seq((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip println(left.isInstanceOf[scala.collection.SeqViewLike[_,_,_]]) val (l, m, r) = Seq((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3 - println(l.isInstanceOf[scala.collection.SeqViewLike[_,_,_]]) + println(l.isInstanceOf[scala.collection.SeqViewLike[_,_,_]]) } { val (left, right) = Iterable((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip println(left.isInstanceOf[scala.collection.IterableViewLike[_,_,_]]) val (l, m, r) = Iterable((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3 - println(l.isInstanceOf[scala.collection.IterableViewLike[_,_,_]]) + println(l.isInstanceOf[scala.collection.IterableViewLike[_,_,_]]) } { val (left, right) = Traversable((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip println(left.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]]) val (l, m, r) = Traversable((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3 - println(l.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]]) + println(l.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]]) } } diff --git a/test/files/run/t5072.check b/test/files/run/t5072.check index 8fe75f55d6..ddd49c71cb 100644 --- a/test/files/run/t5072.check +++ b/test/files/run/t5072.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class C defined class C @@ -10,5 +8,3 @@ scala> Thread.currentThread.getContextClassLoader.loadClass(classOf[C].getName) res0: Class[_] = class C scala> - -scala> diff --git a/test/files/run/t5125b.scala b/test/files/run/t5125b.scala index 29c08fee4c..149c49e213 100644 --- a/test/files/run/t5125b.scala +++ b/test/files/run/t5125b.scala @@ -7,7 +7,7 @@ class C2 { @scala.annotation.varargs def f(values:String*) = println("Calling C2.f(): " + values) def g(): String => Int = s => s.hashCode - + class C3 { @scala.annotation.varargs def f(values:String*) = println("Calling C3.f(): " + values) diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check index b7617e80a2..5705acf20a 100644 --- a/test/files/run/t5256d.check +++ b/test/files/run/t5256d.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ @@ -28,5 +26,3 @@ scala.AnyRef { } scala> - -scala> diff --git a/test/files/run/t5262.scala b/test/files/run/t5262.scala index fc4e57aa96..67448442da 100644 --- a/test/files/run/t5262.scala +++ b/test/files/run/t5262.scala @@ -6,21 +6,21 @@ object Test { - + def serializationDeserialization(obj : Any) { val bos = new java.io.ByteArrayOutputStream() val out = new java.io.ObjectOutputStream(bos) out.writeObject(obj) - + val arr = bos.toByteArray() val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(arr)) val o = in.readObject() println(o) } - + def main(args : Array[String]) { serializationDeserialization(List(1,2,3,4)) serializationDeserialization(List(1,2,null,4)) } - + } diff --git a/test/files/run/t5284b.scala b/test/files/run/t5284b.scala index a9282a895f..0da7972490 100644 --- a/test/files/run/t5284b.scala +++ b/test/files/run/t5284b.scala @@ -23,6 +23,6 @@ object Foo { class Foo[@specialized(Int) T] { val id: T => T = x => x - + def bar[@specialized(Int) W <: T, @specialized(Int) S](w: W) = id(w) } diff --git a/test/files/run/t5284c.scala b/test/files/run/t5284c.scala index 383b84c2cc..dec743fb94 100644 --- a/test/files/run/t5284c.scala +++ b/test/files/run/t5284c.scala @@ -25,6 +25,6 @@ object Foo { class Foo[@specialized(Int) T] { val len: List[T] => Int = xs => xs.length - + def bar[@specialized(Int) W <: T](ws: List[W]) = len(ws) } diff --git a/test/files/run/t5293-map.scala b/test/files/run/t5293-map.scala index 2707aed07e..ad1bbcfe30 100644 --- a/test/files/run/t5293-map.scala +++ b/test/files/run/t5293-map.scala @@ -6,7 +6,7 @@ import scala.collection.JavaConverters._ object Test extends App { - + def bench(label: String)(body: => Unit): Long = { val start = System.nanoTime @@ -15,14 +15,14 @@ object Test extends App { val end = System.nanoTime //println("%s: %s ms".format(label, (end - start) / 1000.0 / 1000.0)) - + end - start } - + def benchJava(values: java.util.Map[Int, Int]) = { bench("Java Map") { val m = new java.util.HashMap[Int, Int] - + m.putAll(values) } } @@ -30,33 +30,33 @@ object Test extends App { def benchScala(values: Iterable[(Int, Int)]) = { bench("Scala Map") { val m = new scala.collection.mutable.HashMap[Int, Int] - + m ++= values } } - + def benchScalaSorted(values: Iterable[(Int, Int)]) = { bench("Scala Map sorted") { val m = new scala.collection.mutable.HashMap[Int, Int] - + m ++= values.toArray.sorted } } - + def benchScalaPar(values: Iterable[(Int, Int)]) = { bench("Scala ParMap") { val m = new scala.collection.parallel.mutable.ParHashMap[Int, Int] map { x => x } - + m ++= values } } - + val total = 50000 val values = (0 until total) zip (0 until total) val map = scala.collection.mutable.HashMap.empty[Int, Int] - + map ++= values - + // warmup for (x <- 0 until 5) { benchJava(map.asJava) @@ -66,15 +66,15 @@ object Test extends App { benchScala(map) benchScalaPar(map) } - + val javamap = benchJava(map.asJava) val scalamap = benchScala(map) val scalaparmap = benchScalaPar(map) - + // println(javamap) // println(scalamap) // println(scalaparmap) - + assert(scalamap < (javamap * 10), "scalamap: " + scalamap + " vs. javamap: " + javamap) assert(scalaparmap < (javamap * 10), "scalaparmap: " + scalaparmap + " vs. javamap: " + javamap) } diff --git a/test/files/run/t5293.scala b/test/files/run/t5293.scala index 01ead45d2a..c42c967b42 100644 --- a/test/files/run/t5293.scala +++ b/test/files/run/t5293.scala @@ -6,7 +6,7 @@ import scala.collection.JavaConverters._ object Test extends App { - + def bench(label: String)(body: => Unit): Long = { val start = System.nanoTime @@ -15,14 +15,14 @@ object Test extends App { val end = System.nanoTime //println("%s: %s ms".format(label, (end - start) / 1000.0 / 1000.0)) - + end - start } - + def benchJava(values: java.util.Collection[Int]) = { bench("Java Set") { val set = new java.util.HashSet[Int] - + set.addAll(values) } } @@ -30,32 +30,32 @@ object Test extends App { def benchScala(values: Iterable[Int]) = { bench("Scala Set") { val set = new scala.collection.mutable.HashSet[Int] - + set ++= values } } - + def benchScalaSorted(values: Iterable[Int]) = { bench("Scala Set sorted") { val set = new scala.collection.mutable.HashSet[Int] - + set ++= values.toArray.sorted } } - + def benchScalaPar(values: Iterable[Int]) = { bench("Scala ParSet") { val set = new scala.collection.parallel.mutable.ParHashSet[Int] map { x => x } - + set ++= values } } - + val values = 0 until 50000 val set = scala.collection.mutable.HashSet.empty[Int] - + set ++= values - + // warmup for (x <- 0 until 5) { benchJava(set.asJava) @@ -65,11 +65,11 @@ object Test extends App { benchScala(set) benchScalaPar(set) } - + val javaset = benchJava(set.asJava) val scalaset = benchScala(set) val scalaparset = benchScalaPar(set) - + assert(scalaset < (javaset * 8), "scalaset: " + scalaset + " vs. javaset: " + javaset) assert(scalaparset < (javaset * 8), "scalaparset: " + scalaparset + " vs. javaset: " + javaset) } diff --git a/test/files/run/t5300.scala b/test/files/run/t5300.scala index 073b29604a..0f1c807177 100644 --- a/test/files/run/t5300.scala +++ b/test/files/run/t5300.scala @@ -1,6 +1,6 @@ object Test { val pf: PartialFunction[Any, Unit] = { case _ => () } - + def main(args: Array[String]): Unit = { pf orElse pf } diff --git a/test/files/run/t5313.scala b/test/files/run/t5313.scala index 4cbc29ba5d..0d7168fa89 100644 --- a/test/files/run/t5313.scala +++ b/test/files/run/t5313.scala @@ -3,7 +3,7 @@ import scala.tools.partest.IcodeComparison object Test extends IcodeComparison { override def printIcodeAfterPhase = "dce" - override def extraSettings: String = super.extraSettings + " -optimize" + override def extraSettings: String = super.extraSettings + " -optimize" override def code = """class Foo { @@ -18,11 +18,11 @@ object Test extends IcodeComparison { val erased3 = erased2 // and this var erased4 = erased2 // and this val erased5 = erased4 // and this - var kept2: Object = new Object // ultimately can't be eliminated + var kept2: Object = new Object // ultimately can't be eliminated while(randomBoolean) { val kept3 = kept2 kept2 = null // this can't, because it clobbers kept2, which is used - erased4 = null // safe to eliminate + erased4 = null // safe to eliminate println(kept3) } var kept4 = new Object // have to keep, it's used diff --git a/test/files/run/t5428.scala b/test/files/run/t5428.scala index fb58cbbe24..44003e06ba 100644 --- a/test/files/run/t5428.scala +++ b/test/files/run/t5428.scala @@ -11,19 +11,19 @@ class A extends StackProxy[Int] { object Test { - + def main(args: Array[String]) { val a = new A - + a push 3 a push 4 a push 5 - + a.push(6, 7, 8) - + println(a) - + a.pop } - + } diff --git a/test/files/run/t5488-fn.scala b/test/files/run/t5488-fn.scala index d17bcf90a5..e6efe176c7 100644 --- a/test/files/run/t5488-fn.scala +++ b/test/files/run/t5488-fn.scala @@ -4,7 +4,7 @@ class C[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B, @specialized(I object Test { def main(args:Array[String]) { def show(x: Any) = println(x.getClass.getName) - + show(new B((x: Int) => 1)) show(new B((x: Int) => "abc")) show(new B((x: Int) => ())) diff --git a/test/files/run/t5488.scala b/test/files/run/t5488.scala index 7bab0cdc3c..f93cf29060 100644 --- a/test/files/run/t5488.scala +++ b/test/files/run/t5488.scala @@ -5,15 +5,15 @@ class C0[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B, @specialized( object Test { def main(args:Array[String]) { def show(x: Any) = println(x.getClass.getName) - + show(new A0[Int]()) show(new A0[AnyRef]()) - + show(new B0[Int, Int]()) show(new B0[Int, AnyRef]()) show(new B0[AnyRef, Int]()) show(new B0[AnyRef, AnyRef]()) - + show(new C0[Int, Int, Int]()) show(new C0[Int, Int, AnyRef]()) show(new C0[Int, AnyRef, Int]()) diff --git a/test/files/run/t5500b.scala b/test/files/run/t5500b.scala index 32de858e7b..9a49624fde 100644 --- a/test/files/run/t5500b.scala +++ b/test/files/run/t5500b.scala @@ -26,7 +26,7 @@ object Test { println(new C1A[Double, Int].getClass.getName) println(new C1A[Double, Double].getClass.getName) println(new C1A[Double, String].getClass.getName) - + println(new C1B[String, Int]("abc").getClass.getName) println(new C1B[String, Double]("abc").getClass.getName) println(new C1B[String, String]("abc").getClass.getName) @@ -36,7 +36,7 @@ object Test { println(new C1B[Double, Int](1d).getClass.getName) println(new C1B[Double, Double](1d).getClass.getName) println(new C1B[Double, String](1d).getClass.getName) - + println(new C1C("abc", 123).getClass.getName) println(new C1C("abc", 123).getClass.getName) println(new C1C("a", 1d).getClass.getName) diff --git a/test/files/run/t5535.check b/test/files/run/t5535.check index 8da9829b78..a0c87a47f4 100644 --- a/test/files/run/t5535.check +++ b/test/files/run/t5535.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> def h()(i: Int) = 1 + i h: ()(i: Int)Int @@ -16,5 +14,3 @@ scala> println(f(10)) 11 scala> - -scala> diff --git a/test/files/run/t5537.check b/test/files/run/t5537.check index 68c3ebf2e2..b9d521f301 100644 --- a/test/files/run/t5537.check +++ b/test/files/run/t5537.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> List[Predef.type]() res0: List[scala.Predef.type] = List() @@ -16,5 +14,3 @@ scala> List[Set.type]() res3: List[Set.type] = List() scala> - -scala> diff --git a/test/files/run/t5577.scala b/test/files/run/t5577.scala index b5d6d8c5b6..650b3c2c69 100644 --- a/test/files/run/t5577.scala +++ b/test/files/run/t5577.scala @@ -6,22 +6,22 @@ import collection._ object Test { - + class AlarmingBuffer[T] extends mutable.ArrayBuffer[T] { override def sizeHint(x: Int) { println("Received a size hint: " + x) super.sizeHint(x) } } - + def main(args: Array[String]) { val iteratorBuilder = (new AlarmingBuffer[Int]) mapResult { res => res.iterator } - + iteratorBuilder.sizeHint(10) iteratorBuilder ++= (0 until 10) iteratorBuilder.result.foreach(println) } - + } diff --git a/test/files/run/t5583.check b/test/files/run/t5583.check index 39b969fbe7..af96405bdd 100644 --- a/test/files/run/t5583.check +++ b/test/files/run/t5583.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> var s = 0 s: Int = 0 @@ -16,5 +14,3 @@ scala> println(s) 165 scala> - -scala> diff --git a/test/files/run/t5590.scala b/test/files/run/t5590.scala index 9c806e0b7d..baf0503a04 100644 --- a/test/files/run/t5590.scala +++ b/test/files/run/t5590.scala @@ -7,25 +7,25 @@ import collection._ object Test { - + def check(obj: AnyRef) { println(obj) - + val bos = new ByteArrayOutputStream() val out = new ObjectOutputStream(bos) out.writeObject(obj) val arr = bos.toByteArray() val in = new ObjectInputStream(new ByteArrayInputStream(arr)) val deser = in.readObject() - + println(deser) } - + def main(args: Array[String]) { val lhm = mutable.LinkedHashMap("a" -> "a", "b" -> "b", "c" -> "c") val lhs = mutable.LinkedHashSet("a", "b", "c", "d", "e") check(lhm) check(lhs) } - + } diff --git a/test/files/run/t5610.scala b/test/files/run/t5610.scala index f62b2df6b4..82dabcc59f 100644 --- a/test/files/run/t5610.scala +++ b/test/files/run/t5610.scala @@ -20,7 +20,7 @@ object Test { val f: (String, Int*) => Unit = m(2, 3) f("", 5, 6) } - + def foo(s: => String)(dummy: Int) = () => println(s) def m(a: Int*)(z: String, b: Int*) { diff --git a/test/files/run/t5629.scala b/test/files/run/t5629.scala index 69feddd3a5..5b91007f7e 100644 --- a/test/files/run/t5629.scala +++ b/test/files/run/t5629.scala @@ -27,10 +27,10 @@ class AnyChild extends Parent[Any] { object Test { - + def main(args: Array[String]) { new IntChild().foo(33) new AnyChild().foo(33) } - + } diff --git a/test/files/run/t5629b.scala b/test/files/run/t5629b.scala index adb9ca5498..9ff29c8d89 100644 --- a/test/files/run/t5629b.scala +++ b/test/files/run/t5629b.scala @@ -4,7 +4,7 @@ object Test extends App { - + trait MyPF[@specialized(Int) -A] extends (A => Unit) { def isDefinedAt(x: A): Boolean def applyOrElse[A1 <: A](x: A1, default: A1 => Unit): Unit = { @@ -12,30 +12,30 @@ object Test extends App { if (isDefinedAt(x)) apply(x) else default(x) } } - + trait MySmartPF[@specialized(Int) -A] extends MyPF[A] { def apply(x: A): Unit = { println("MySmartPF.apply entered...") applyOrElse(x, { _: Any => throw new MatchError }) } } - + type T = Int //type T = Any - + def newPF(test: T): MyPF[T] = new MySmartPF[T] { def isDefinedAt(x: T): Boolean = x != test override def applyOrElse[A1 <: T](x: A1, default: A1 => Unit): Unit = { println("newPF.applyOrElse entered...") - if (x != test) { println("ok"); () } else { println("default"); default(x) } + if (x != test) { println("ok"); () } else { println("default"); default(x) } } } - + val pf = newPF(1) println("=== pf(1):") try { pf(1) } catch { case x: Throwable => println(x) } println("=== pf(42):") pf(42) println("=== done") - + } diff --git a/test/files/run/t5655.check b/test/files/run/t5655.check index 1103b0e36f..06c6b32599 100644 --- a/test/files/run/t5655.check +++ b/test/files/run/t5655.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> object x { def x={} } defined object x @@ -26,5 +24,3 @@ and import x ^ scala> - -scala> diff --git a/test/files/run/t5656.scala b/test/files/run/t5656.scala index f5ea147a4e..5eb1df51af 100644 --- a/test/files/run/t5656.scala +++ b/test/files/run/t5656.scala @@ -3,9 +3,9 @@ object Test { - + def main(args: Array[String]) { println(Seq(List('1', '2', '3'), List('a', 'b', 'c')).view.addString(new StringBuilder, "_")) } - + } diff --git a/test/files/run/t5676.scala b/test/files/run/t5676.scala index b643c300ce..0c920e4a9d 100644 --- a/test/files/run/t5676.scala +++ b/test/files/run/t5676.scala @@ -13,12 +13,12 @@ class Baz[S] extends Foo[S] { } object Test { - + def main(a: Array[String]) { val b = new Baz[Any] println(b.A.foo()) println(Modifier.isFinal(classOf[Baz[Any]].getModifiers())) println(Modifier.isFinal(Test.getClass.getModifiers())) } - + } diff --git a/test/files/run/t5753_1/Test_2.scala b/test/files/run/t5753_1/Test_2.scala index a2777638bc..864d356fdb 100644 --- a/test/files/run/t5753_1/Test_2.scala +++ b/test/files/run/t5753_1/Test_2.scala @@ -1,4 +1,4 @@ -object Test extends App { +object Test extends App { import Macros._ println(foo(42)) }
\ No newline at end of file diff --git a/test/files/run/t5753_2/Impls_Macros_1.scala b/test/files/run/t5753_2/Impls_Macros_1.scala index e23c0b938b..41d584d0ac 100644 --- a/test/files/run/t5753_2/Impls_Macros_1.scala +++ b/test/files/run/t5753_2/Impls_Macros_1.scala @@ -1,7 +1,7 @@ import scala.reflect.macros.{Context => Ctx} trait Macro_T { - def foo[T](c: Ctx)(s: c.Expr[T]) = s + def foo[T](c: Ctx)(s: c.Expr[T]) = s } object Macros { diff --git a/test/files/run/t5753_2/Test_2.scala b/test/files/run/t5753_2/Test_2.scala index a2777638bc..864d356fdb 100644 --- a/test/files/run/t5753_2/Test_2.scala +++ b/test/files/run/t5753_2/Test_2.scala @@ -1,4 +1,4 @@ -object Test extends App { +object Test extends App { import Macros._ println(foo(42)) }
\ No newline at end of file diff --git a/test/files/run/t5789.check b/test/files/run/t5789.check index ea8d4966b1..bcb2382559 100644 --- a/test/files/run/t5789.check +++ b/test/files/run/t5789.check @@ -1,14 +1,10 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> val n = 2 +scala> val n = 2 n: Int = 2 scala> () => n res0: () => Int = <function0> scala> - -scala> diff --git a/test/files/run/t5804.scala b/test/files/run/t5804.scala index b96a736035..b6a8940c1f 100644 --- a/test/files/run/t5804.scala +++ b/test/files/run/t5804.scala @@ -4,29 +4,29 @@ import collection.mutable._ object Test { - + def main(args: Array[String]) { class CustomHashMap extends HashMap[Int, Int] { override def initialSize = 65 - + println(table.length) } - + new CustomHashMap new HashMap { println(table.length) } - + class CustomHashSet extends HashSet[Int] { override def initialSize = 96 - + println(table.length) } - + new CustomHashSet new HashSet { println(table.length) } } - + } diff --git a/test/files/run/t5857.scala b/test/files/run/t5857.scala index bf67bedf54..c82fd88c08 100644 --- a/test/files/run/t5857.scala +++ b/test/files/run/t5857.scala @@ -2,44 +2,44 @@ object Test { - + def time[U](b: =>U): Long = { val start = System.currentTimeMillis b val end = System.currentTimeMillis - + end - start } - + def main(args: Array[String]) { val sz = 1000000000 - + val range = 1 to sz check { assert(range.min == 1, range.min) } check { assert(range.max == sz, range.max) } - + val descending = sz to 1 by -1 check { assert(descending.min == 1) } check { assert(descending.max == sz) } - + val numeric = 1.0 to sz.toDouble by 1 check { assert(numeric.min == 1.0) } check { assert(numeric.max == sz.toDouble) } - + val numdesc = sz.toDouble to 1.0 by -1 check { assert(numdesc.min == 1.0) } check { assert(numdesc.max == sz.toDouble) } } - + def check[U](b: =>U) { val exectime = time { b } - + // whatever it is, it should be less than, say, 250ms // if `max` involves traversal, it takes over 5 seconds on a 3.2GHz i7 CPU //println(exectime) assert(exectime < 250, exectime) } - + } diff --git a/test/files/run/t5867.scala b/test/files/run/t5867.scala index 6a86ac3e6d..f7e9393b7a 100644 --- a/test/files/run/t5867.scala +++ b/test/files/run/t5867.scala @@ -3,12 +3,12 @@ import collection.mutable.UnrolledBuffer object Test { - + def main(args: Array[String]) { val buf = UnrolledBuffer(1 to 50: _*) val dub = buf ++ buf - + println(dub) } - + } diff --git a/test/files/run/t5879.scala b/test/files/run/t5879.scala index 18dd94289d..83a583da54 100644 --- a/test/files/run/t5879.scala +++ b/test/files/run/t5879.scala @@ -2,23 +2,23 @@ import collection.immutable.HashMap object Test { - + def main(args: Array[String]) { resolveDefault() resolveFirst() resolveSecond() resolveMany() } - + def resolveDefault() { val a = HashMap(1 -> "1") val b = HashMap(1 -> "2") - + val r = a.merged(b)(null) println(r) println(r(1)) } - + def resolveFirst() { val a = HashMap(1 -> "1") val b = HashMap(1 -> "2") @@ -26,12 +26,12 @@ object Test { println(a) a } - + val r = a.merged(b) { collision } println(r) println(r(1)) } - + def resolveSecond() { val a = HashMap(1 -> "1") val b = HashMap(1 -> "2") @@ -39,21 +39,21 @@ object Test { println(b) b } - + val r = a.merged(b) { collision } println(r) println(r(1)) } - + def resolveMany() { val a = HashMap((0 until 100) zip (0 until 100): _*) val b = HashMap((0 until 100) zip (100 until 200): _*) def collision(a: (Int, Int), b: (Int, Int)) = { (a._1, a._2 + b._2) } - + val r = a.merged(b) { collision } for ((k, v) <- r) assert(v == 100 + 2 * k, (k, v)) } - + } diff --git a/test/files/run/t5880.scala b/test/files/run/t5880.scala index 4cda599f79..f88df90160 100644 --- a/test/files/run/t5880.scala +++ b/test/files/run/t5880.scala @@ -5,13 +5,13 @@ import scala.collection.JavaConversions._ object Test { - + def main(args:Array[String]) = { val tests = 5000 val jm: java.util.Map[Int, Int] = scala.collection.mutable.Map((0 until tests) zip (0 until tests).reverse: _*) val es = jm.entrySet() val it = es.iterator - + // chi square test val groups = 10 val hits = new Array[Int](groups) @@ -28,7 +28,7 @@ object Test { val diffs = for (i <- 0 until groups) yield (hits(i) - expected) * (hits(i) - expected) diffs.sum.toDouble / expected } - + while (it.hasNext) { val x = it.next() hit(x.##) @@ -37,5 +37,5 @@ object Test { // println(ChiSquare) assert(ChiSquare < 4.0, ChiSquare + " -> " + hits.mkString(", ")) } - + } diff --git a/test/files/run/t5937.scala b/test/files/run/t5937.scala index e5bf6617af..9ec4ff12d3 100644 --- a/test/files/run/t5937.scala +++ b/test/files/run/t5937.scala @@ -6,7 +6,7 @@ import collection._ object Test extends App { - + val list: List[Int] = (immutable.Vector(1, 2, 3) :+ 4)(breakOut) - + } diff --git a/test/files/run/t5971.scala b/test/files/run/t5971.scala index dbd9beebb3..bc24255ece 100644 --- a/test/files/run/t5971.scala +++ b/test/files/run/t5971.scala @@ -12,12 +12,12 @@ * Mind blowing, I know. */ object Test { - + def main(args: Array[String]) { println("bar".view.reverse.filter(_ > 'a').mkString(",")) println("bar".view.reverse.take(1).mkString(",")) println("bar".view.reverse.dropWhile(_ > 'a').mkString(",")) println("bar".view.reverse.takeWhile(_ => true).mkString(",")) } - + } diff --git a/test/files/run/t5986.scala b/test/files/run/t5986.scala index 8cf7086f98..b9c21a7b37 100644 --- a/test/files/run/t5986.scala +++ b/test/files/run/t5986.scala @@ -9,22 +9,22 @@ import scala.collection._ * and the element already exists in the set. */ object Test { - + class Foo(val name: String, val n: Int) { override def equals(obj: Any): Boolean = obj match { case other: Foo => name == other.name; case _ => false } override def hashCode = name.## override def toString = "Foo(" + name + ", " + n + ")" } - + implicit val ordering: Ordering[Foo] = Ordering.fromLessThan[Foo] { (a, b) => a.name.compareTo(b.name) < 0 } - + def check[S <: Set[Foo]](set: S) { def output(s: Set[Foo]) = println(s.toList.sorted.mkString(",")) output(set + new Foo("bar", 2)) output(set ++ List(new Foo("bar", 2), new Foo("bar", 3), new Foo("bar", 4))) output(set union Set(new Foo("bar", 2), new Foo("baz", 3), new Foo("bazz", 4))) } - + def main(args: Array[String]) { check(Set(new Foo("bar", 1))) check(immutable.Set(new Foo("bar", 1))) @@ -32,5 +32,5 @@ object Test { check(immutable.SortedSet(new Foo("bar", 1))) check(mutable.SortedSet(new Foo("bar", 1))) } - + } diff --git a/test/files/run/t603.scala b/test/files/run/t603.scala index 54fb8e6974..84a224a40a 100644 --- a/test/files/run/t603.scala +++ b/test/files/run/t603.scala @@ -24,7 +24,7 @@ object forceDelay { object Test { import forceDelay._ - + def main(args: Array[String]) = { val s: Susp[Int] = delay { Console.println("evaluating..."); 3 } Console.println("s = " + s) diff --git a/test/files/run/t6052.scala b/test/files/run/t6052.scala index 385d5390d3..5482cfb293 100644 --- a/test/files/run/t6052.scala +++ b/test/files/run/t6052.scala @@ -8,13 +8,13 @@ object Test extends App { def seqarr(i: Int) = Array[Int]() ++ (0 until i) def pararr(i: Int) = seqarr(i).par - + def check[T](i: Int, f: Int => T) { val gseq = seqarr(i).toSeq.groupBy(f) val gpar = pararr(i).groupBy(f) assert(gseq == gpar, (gseq, gpar)) } - + for (i <- 0 until 20) check(i, _ > 0) for (i <- 0 until 20) check(i, _ % 2) for (i <- 0 until 20) check(i, _ % 4) diff --git a/test/files/run/t6070.scala b/test/files/run/t6070.scala index b6af48ef21..434949f869 100644 --- a/test/files/run/t6070.scala +++ b/test/files/run/t6070.scala @@ -11,7 +11,7 @@ class StringBomb extends Bomb { def size(that: String): Int = that.length } -class IntBomb extends Bomb { +class IntBomb extends Bomb { type T = Int val x = 10 @@ -22,7 +22,7 @@ case class Mean(var bomb: Bomb) object Test extends App { def foo(x: Mean) = x match { - case Mean(b) => + case Mean(b) => // BUG: b is assumed to be a stable identifier, but it can actually be mutated println(b.size({ mutate(); b.x })) } diff --git a/test/files/run/t6086-repl.check b/test/files/run/t6086-repl.check index 97f20bd66b..115eff5f85 100644 --- a/test/files/run/t6086-repl.check +++ b/test/files/run/t6086-repl.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> case class X(s: String) defined class X diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check index 2333b9d986..a3b09efcd9 100644 --- a/test/files/run/t6146b.check +++ b/test/files/run/t6146b.check @@ -45,7 +45,7 @@ scala> val mt1 = memType(S1, fTpe) mt1: u.Type = O.X.S1.type scala> global.typeDeconstruct.show(mt1) -res0: String = +res0: String = TypeRef( pre = SingleType(pre = ThisType(object O), object X) TypeSymbol(class S1 extends C.this.F[T]) diff --git a/test/files/run/t6168/Context.java b/test/files/run/t6168/Context.java index e527844563..d0fb5d2543 100644 --- a/test/files/run/t6168/Context.java +++ b/test/files/run/t6168/Context.java @@ -10,7 +10,7 @@ public class Context<ParentType> { public void setParent(ParentType parent) { this.parent = parent; } - + public Field<Integer> intField() { return new Field<Integer>() { @Override diff --git a/test/files/run/t6259.scala b/test/files/run/t6259.scala index 294c95e96b..b2c27df51f 100644 --- a/test/files/run/t6259.scala +++ b/test/files/run/t6259.scala @@ -37,9 +37,9 @@ object Early extends { class DoubleTrouble[X](x: AnyRef)(implicit override val tt: TypeTag[X]) extends A[X] object DoubleOk extends DoubleTrouble[String]({ - // Drops to this.getClass and is an issue - object InnerTrouble extends A[String]; - InnerTrouble + // Drops to this.getClass and is an issue + object InnerTrouble extends A[String]; + InnerTrouble }) object Test extends App { diff --git a/test/files/run/t6273.check b/test/files/run/t6273.check index c1c18daac2..bef0b227d2 100644 --- a/test/files/run/t6273.check +++ b/test/files/run/t6273.check @@ -1,19 +1,15 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> val y = 55 y: Int = 55 scala> val x = s""" y = $y """ -x: String = +x: String = " y = 55 " scala> - -scala> diff --git a/test/files/run/t6320.check b/test/files/run/t6320.check index e56bacd223..013acc1c54 100644 --- a/test/files/run/t6320.check +++ b/test/files/run/t6320.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.language.dynamics import scala.language.dynamics @@ -13,5 +11,3 @@ scala> new Dyn(Map("foo" -> 10)).foo[Int] res0: Int = 10 scala> - -scala> diff --git a/test/files/run/t6329_repl.check b/test/files/run/t6329_repl.check index 3480bbdd0b..5049426ab4 100644 --- a/test/files/run/t6329_repl.check +++ b/test/files/run/t6329_repl.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.classTag import scala.reflect.classTag @@ -35,5 +33,3 @@ scala> classTag[scala.collection.immutable.Set[_]] res7: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set scala> - -scala> diff --git a/test/files/run/t6439.check b/test/files/run/t6439.check index 3f5f7dc8a4..f804fa75f4 100644 --- a/test/files/run/t6439.check +++ b/test/files/run/t6439.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class A defined class A @@ -73,5 +71,3 @@ scala> lookup("F") // this now works as a result of changing .typeSymbol to .typ res0: $r.intp.global.Symbol = type F scala> - -scala> diff --git a/test/files/run/t6507.check b/test/files/run/t6507.check index 336db0aeaf..3536c42381 100644 --- a/test/files/run/t6507.check +++ b/test/files/run/t6507.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> :silent Switched off result printing. diff --git a/test/files/run/t6549.check b/test/files/run/t6549.check index bc78aac741..d5dfc5ebe8 100644 --- a/test/files/run/t6549.check +++ b/test/files/run/t6549.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> case class `X"`(var xxx: Any) defined class X$u0022 @@ -28,5 +26,3 @@ scala> val `"` = 0 ": Int = 0 scala> - -scala> diff --git a/test/files/run/t6632.scala b/test/files/run/t6632.scala index c1c8d4abe0..0242e60104 100644 --- a/test/files/run/t6632.scala +++ b/test/files/run/t6632.scala @@ -1,6 +1,6 @@ object Test extends App { import collection.mutable.ListBuffer - + def newLB = ListBuffer('a, 'b, 'c, 'd, 'e) val lb0 = newLB diff --git a/test/files/run/t6669.scala b/test/files/run/t6669.scala index b55718b12b..e18f2514a9 100644 --- a/test/files/run/t6669.scala +++ b/test/files/run/t6669.scala @@ -2,7 +2,7 @@ import java.io.{ByteArrayOutputStream, PrintStream} object Test extends App { val baos = new ByteArrayOutputStream() - val ps = new PrintStream(baos) + val ps = new PrintStream(baos) // first test with the default classpath (scala.Console withOut ps) { diff --git a/test/files/run/t6863.scala b/test/files/run/t6863.scala index c4f3c2c885..7210ebc01d 100644 --- a/test/files/run/t6863.scala +++ b/test/files/run/t6863.scala @@ -3,34 +3,34 @@ object Test { def lazyVal() = { // internally lazy vals become vars which are initialized with "_", so they need to be tested just like vars do lazy val x = "42" - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def ident() = { val y = "42" var x = y - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def apply() = { def y(x : Int) = x.toString var x = y(42) - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def literal() = { var x = "42" - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def `new`() = { var x = new String("42") - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def select() = { object Foo{val bar = "42"} var x = Foo.bar - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def `throw`() = { var x = if (true) "42" else throw new Exception("42") - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def assign() = { var y = 1 @@ -59,7 +59,7 @@ object Test { assert({ () => x }.apply == ()) } def ifElse() = { - var x = if(true) "42" else "43" + var x = if(true) "42" else "43" assert({ () => x }.apply == "42") } def matchCase() = { @@ -77,7 +77,7 @@ object Test { assert({ () => x }.apply == "42") } def labelDef() = { - var x = 100 match { + var x = 100 match { case 100 => try "42" finally () } assert({ () => x }.apply == "42") @@ -86,7 +86,7 @@ object Test { var x = { val y = 42 if(true) try "42" catch {case _: Throwable => "43"} - else "44" + else "44" } assert({ () => x }.apply == "42") } diff --git a/test/files/run/t6937.check b/test/files/run/t6937.check index 9a1fa4cfaf..4729dc7006 100644 --- a/test/files/run/t6937.check +++ b/test/files/run/t6937.check @@ -1,9 +1,7 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> import scala.reflect.runtime.{universe => ru} +scala> import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{universe=>ru} scala> import scala.reflect.runtime.{currentMirror => cm} @@ -22,5 +20,3 @@ scala> apiru.typeTag[A].in(cm) res0: reflect.runtime.universe.TypeTag[A] = TypeTag[A] scala> - -scala> diff --git a/test/files/run/t7181.scala b/test/files/run/t7181.scala index a055e43481..489ec313f6 100644 --- a/test/files/run/t7181.scala +++ b/test/files/run/t7181.scala @@ -21,7 +21,7 @@ object Test extends App { val result = try driver(action) catch { - case UncaughtException(a) => + case UncaughtException(a) => gotException = true a } @@ -35,13 +35,13 @@ object Test extends App { def driver(action: Action): Action = { val result = try { action match { - case MainNormalExit => + case MainNormalExit => println(s"normal exit $action") action case MainReturn => println(s"return $action") return action - case MainUncaughtException => + case MainUncaughtException => println(s"uncaught exception $action") throw UncaughtException(action) case _ => @@ -50,16 +50,16 @@ object Test extends App { } } catch { case CaughtException(action) => action match { - case ExceptionNormalExit => + case ExceptionNormalExit => println(s"normal exit $action") action - case ExceptionReturn => + case ExceptionReturn => println(s"return $action") return action - case ExceptionUncaughtException => + case ExceptionUncaughtException => println(s"uncaught exception $action") throw UncaughtException(action) - case _ => + case _ => sys.error(s"unexpected $action in exception handler") } } finally { diff --git a/test/files/run/t7185.check b/test/files/run/t7185.check index f95910ba5f..38449b3497 100644 --- a/test/files/run/t7185.check +++ b/test/files/run/t7185.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.tools.reflect.ToolBox import scala.tools.reflect.ToolBox @@ -16,7 +14,7 @@ scala> val ORef = reify { O }.tree ORef: reflect.runtime.universe.Tree = $read.O scala> val tree = Apply(Block(Nil, Block(Nil, ORef)), Nil) -tree: reflect.runtime.universe.Apply = +tree: reflect.runtime.universe.Apply = { { $read.O @@ -24,7 +22,7 @@ tree: reflect.runtime.universe.Apply = }() scala> {val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typeCheck(tree): Any} -res0: Any = +res0: Any = { { $read.O.apply() diff --git a/test/files/run/t7291.scala b/test/files/run/t7291.scala index d996c615ce..ca44e96693 100644 --- a/test/files/run/t7291.scala +++ b/test/files/run/t7291.scala @@ -17,6 +17,6 @@ elem: Fooable[T]): Fooable[Coll[T]] = { new Fooable[Coll[T]]{} } def main(args: Array[String]) { - implicitly[Fooable[List[Any]]] + implicitly[Fooable[List[Any]]] } } diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check index b5081f2d00..d03ee3a6cf 100644 --- a/test/files/run/t7319.check +++ b/test/files/run/t7319.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class M[A] defined class M diff --git a/test/files/run/t7331b.check b/test/files/run/t7331b.check index 7034a95a3f..413c93aaf7 100644 --- a/test/files/run/t7331b.check +++ b/test/files/run/t7331b.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: ')' expected but eof found. diff --git a/test/files/run/t7336.scala b/test/files/run/t7336.scala index ace83f2c1f..21b0be5446 100644 --- a/test/files/run/t7336.scala +++ b/test/files/run/t7336.scala @@ -9,7 +9,7 @@ import scala.concurrent.duration.Duration * resulting in a speedy OutOfMemoryError. Now, each array should be freed soon * after it is created and the test should complete without problems. */ -object Test { +object Test { def main(args: Array[String]) { def loop(i: Int, arraySize: Int): Future[Unit] = { val array = new Array[Byte](arraySize) diff --git a/test/files/run/t7341.scala b/test/files/run/t7341.scala index dc526c6c19..ffea7f918b 100755 --- a/test/files/run/t7341.scala +++ b/test/files/run/t7341.scala @@ -4,7 +4,7 @@ object Obj { def foo { returning(() => cache = ()) } - + def apply(): Any = { cache } diff --git a/test/files/run/t744.scala b/test/files/run/t744.scala index d5e9f6df34..4895e9baa0 100644 --- a/test/files/run/t744.scala +++ b/test/files/run/t744.scala @@ -5,7 +5,7 @@ trait Linked { } } object Test { - class Test extends Linked { + class Test extends Linked { trait FileImpl extends super.FileImpl { // val x: int = 1 } diff --git a/test/files/run/t7482a.check b/test/files/run/t7482a.check index b26e685784..943538f352 100644 --- a/test/files/run/t7482a.check +++ b/test/files/run/t7482a.check @@ -1,14 +1,10 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5) +scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5) v: java.util.ArrayList[String] = [] scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5) v: java.util.ArrayList[String] = [] scala> - -scala> diff --git a/test/files/run/t874.scala b/test/files/run/t874.scala index 7e70fc34eb..b077859ef3 100644 --- a/test/files/run/t874.scala +++ b/test/files/run/t874.scala @@ -7,7 +7,7 @@ object Test { } U("xyz")(2) } - class Mix extends Base { + class Mix extends Base { case class U[A](x1: A)(x2: Int) { Console.println("U created with "+x1+" and "+x2) } diff --git a/test/files/run/t920.scala b/test/files/run/t920.scala index 1e12e6ba87..6a7f122d55 100644 --- a/test/files/run/t920.scala +++ b/test/files/run/t920.scala @@ -7,7 +7,7 @@ object Test { trait Foo extends Test.Foo0 { def foo : B.this.type = B.this; } - class baz extends Baz with Foo { + class baz extends Baz with Foo { override def toString = "baz" } Console.println(new baz); diff --git a/test/files/run/takeAndDrop.scala b/test/files/run/takeAndDrop.scala index 6e87838e11..8d2dff0bfa 100644 --- a/test/files/run/takeAndDrop.scala +++ b/test/files/run/takeAndDrop.scala @@ -1,9 +1,9 @@ -object Test { +object Test { def main(args: Array[String]): Unit = { val range = 1 to 10 val target = (3 to 8).toList val confirm = (xs: Seq[Int]) => assert(xs.toList == target, xs) - + confirm(range drop 2 dropRight 2) confirm(range drop 1 dropRight 1 drop 1 dropRight 1) confirm(range take 8 drop 2) diff --git a/test/files/run/tcpoly_monads.scala b/test/files/run/tcpoly_monads.scala index 6372851451..978f889590 100644 --- a/test/files/run/tcpoly_monads.scala +++ b/test/files/run/tcpoly_monads.scala @@ -7,15 +7,15 @@ trait Monads { * (>>=) :: m a -> (a -> m b) -> m b * return :: a -> m a * - * MonadTC encodes the above Haskell type class, + * MonadTC encodes the above Haskell type class, * an instance of MonadTC corresponds to a method dictionary. * (see http://lampwww.epfl.ch/~odersky/talks/wg2.8-boston06.pdf) * * Note that the identity (`this') of the method dictionary does not really correspond - * to the instance of m[x] (`self') that is `wrapped': e.g., unit does not use `self' (which + * to the instance of m[x] (`self') that is `wrapped': e.g., unit does not use `self' (which * corresponds to the argument of the implicit conversion that encodes an instance of this type class) */ - trait MonadTC[m[x], a] { + trait MonadTC[m[x], a] { def unit[a](orig: a): m[a] // >>='s first argument comes from the implicit definition constructing this "method dictionary" @@ -30,7 +30,7 @@ trait Monads { */ trait OptionMonad extends Monads { // this implicit method encodes the Monad type class instance for Option - implicit def OptionInstOfMonad[a](self: Option[a]): MonadTC[Option, a] + implicit def OptionInstOfMonad[a](self: Option[a]): MonadTC[Option, a] = new MonadTC[Option, a] { def unit[a](orig: a) = Some(orig) def >>=[b](fun: a => Option[b]): Option[b] = self match { diff --git a/test/files/run/tcpoly_parseridioms.scala b/test/files/run/tcpoly_parseridioms.scala index ec17e062db..c8bcf693a1 100644 --- a/test/files/run/tcpoly_parseridioms.scala +++ b/test/files/run/tcpoly_parseridioms.scala @@ -3,11 +3,11 @@ import scala.language.{ higherKinds, implicitConversions, postfixOps } trait Parsers { type Input = List[Char] - + sealed class ParseResult[+t](val next: Input) - case class Success[+t](override val next: Input, result: t) extends ParseResult[t](next) + case class Success[+t](override val next: Input, result: t) extends ParseResult[t](next) case class Failure(override val next: Input, msg: String) extends ParseResult[Nothing](next) - + abstract class Parser[+t] { def apply(in: Input): ParseResult[t] } @@ -19,7 +19,7 @@ trait Parsers { case Success(next2, y) => Success(next2, Pair(x,y)) case Failure(_, msg) => Failure(in, msg) } - case Failure(_, msg) => Failure(in, msg) + case Failure(_, msg) => Failure(in, msg) } } @@ -41,20 +41,20 @@ trait Parsers { case Failure(n, msg) => Failure(n, msg) } } - + def accept[T](c: Char, r: T): Parser[T] = new Parser[T] { def apply(in: Input) = in match { case c2 :: n if c2 == c => Success(n, r) case n => Failure(n, "expected "+c+" at the head of "+n) } } - - def apply_++[s, tt](fun: Parser[s => tt], arg: Parser[s]): Parser[tt] = lift[Pair[s=>tt, s], tt]({case Pair(f, a) => f(a)})(sq(fun, arg)) - + + def apply_++[s, tt](fun: Parser[s => tt], arg: Parser[s]): Parser[tt] = lift[Pair[s=>tt, s], tt]({case Pair(f, a) => f(a)})(sq(fun, arg)) + def success[u](v: u): Parser[u] = new Parser[u] { def apply(in: Input) = Success(in, v) } - + } trait Idioms { @@ -64,21 +64,21 @@ trait Idioms { def pureMethod[a](name: String, x: a): idi[a] = pure(x) // hack for Mirrors: allow passing of method names } - class IdiomaticTarget[idi[x], idiom <: Idiom[idi], s](i: idiom, tgt: s) { + class IdiomaticTarget[idi[x], idiom <: Idiom[idi], s](i: idiom, tgt: s) { def dot [t](fun: s => t, name: String) = new IdiomaticApp2[idi, idiom, t](i, i.liftedApply(i.pureMethod(name, fun))(i.pure(tgt))) } // TODO: `.` --> java.lang.ClassFormatError: Illegal method name "." in class Idioms$Id$ - class IdiomaticFunction[idi[x], idiom <: Idiom[idi], s, t](i: idiom, fun: s => t) { + class IdiomaticFunction[idi[x], idiom <: Idiom[idi], s, t](i: idiom, fun: s => t) { def <| (a: idi[s]) = new IdiomaticApp[idi, idiom, t](i, i.liftedApply(i.pure(fun))(a)) } class IdiomaticApp[idi[x], idiom <: Idiom[idi], x](i: idiom, a: idi[x]) { // where x <: s=>t -- TODO can this be expressed without generalised constraints? def <> [s, t](b: idi[s]) = new IdiomaticApp[idi, idiom, t](i, i.liftedApply(a.asInstanceOf[idi[s=>t]])(b)) - + def |> : idi[x] = a } - + class IdiomaticApp2[idi[x], idiom <: Idiom[idi], x](i: idiom, a: idi[x]) extends IdiomaticApp[idi, idiom, x](i, a) { def <| [s, t](b: idi[s]) = <>[s,t](b) } @@ -89,22 +89,22 @@ trait ParserIdioms extends Parsers with Idioms { def liftedApply[s, t](fun: Parser[s => t])(arg: Parser[s]): Parser[t] = apply_++(fun, arg) def pure[a](x: a): Parser[a] = success(x) } - - implicit def parserIdiomFun[s, t](fun: s=>t): IdiomaticFunction[Parser, ParserIdiom.type, s, t] = + + implicit def parserIdiomFun[s, t](fun: s=>t): IdiomaticFunction[Parser, ParserIdiom.type, s, t] = new IdiomaticFunction[Parser, ParserIdiom.type, s, t](ParserIdiom, fun) - implicit def parserIdiomTgt[s](tgt: s): IdiomaticTarget[Parser, ParserIdiom.type, s] = + implicit def parserIdiomTgt[s](tgt: s): IdiomaticTarget[Parser, ParserIdiom.type, s] = new IdiomaticTarget[Parser, ParserIdiom.type, s](ParserIdiom, tgt) - + trait Expr case class Plus(a: Int, b: Int) extends Expr - + def num = or(accept('0', 0), or(accept('1', 1),accept('2', 2))) - - // TODO: how can parserIdiom(curry2(_)) be omitted? + + // TODO: how can parserIdiom(curry2(_)) be omitted? def expr: Parser[Expr] = parserIdiomFun(curry2(Plus)) <| num <> num |> - + implicit def curry2[s,t,u](fun: (s, t)=>u)(a: s)(b: t) = fun(a, b) - implicit def curry3[r,s,t,u](fun: (r,s, t)=>u)(a: r)(b: s)(c: t) = fun(a, b, c) + implicit def curry3[r,s,t,u](fun: (r,s, t)=>u)(a: r)(b: s)(c: t) = fun(a, b, c) } object Test extends ParserIdioms with App { diff --git a/test/files/run/test-cpp.scala b/test/files/run/test-cpp.scala index c6eda56776..4e00e72658 100644 --- a/test/files/run/test-cpp.scala +++ b/test/files/run/test-cpp.scala @@ -3,11 +3,11 @@ * in the copy-propagation performed before ClosureElimination. * * In the general case, the local variable 'l' is connected through - * an alias chain with other local variables and at the end of the + * an alias chain with other local variables and at the end of the * alias chain there may be a Value, call it 'v'. * * If 'v' is cheaper to access (it is a Deref(This) or Const(_)), then - * replace the instruction to load it from the cheaper place. + * replace the instruction to load it from the cheaper place. * Otherwise, we use the local variable at the end of the alias chain * instead of 'l'. */ @@ -20,8 +20,8 @@ object Test extends IcodeComparison { import scala.util.Random._ -/** - * The example in the bug report (Issue-5321): an alias chain which store +/** + * The example in the bug report (Issue-5321): an alias chain which store * an Unknown. Should remove local variable 'y'. */ object TestBugReport { @@ -42,20 +42,20 @@ object TestSetterInline { } -/** +/** * The access of the local variable 'y' should be replaced by the * constant. - */ + */ object TestAliasChainConstat { def main(args: Array[String]): Unit = { val x = 2 val y = x - println(y) + println(y) } } -/** +/** * At the end of the alias chain we have a reference to 'this'. * The local variables should be all discarded and replace by a * direct reference to this @@ -72,7 +72,7 @@ class TestAliasChainDerefThis { /** * At the end of the alias chain, there is the value of a field. * The use of variable 'y' should be replaced by 'x', not by an access - * to the field 'f' since it is more costly. + * to the field 'f' since it is more costly. */ object TestAliasChainDerefField { def f = nextInt @@ -86,7 +86,7 @@ object TestAliasChainDerefField { /** - * The first time 'println' is called, 'x' is replaced by 'y' + * The first time 'println' is called, 'x' is replaced by 'y' * and the second time, 'y' is replaced by 'x'. But none of them * can be removed. */ diff --git a/test/files/run/trait-renaming/A_1.scala b/test/files/run/trait-renaming/A_1.scala index 2c3d4f566f..d0fab7bfc3 100644 --- a/test/files/run/trait-renaming/A_1.scala +++ b/test/files/run/trait-renaming/A_1.scala @@ -9,7 +9,7 @@ package bippy { } new B with C { } } - + def g = Class.forName("bippy.A$B$1$class") } } diff --git a/test/files/run/transform.scala b/test/files/run/transform.scala index 82f924950d..d73155ceec 100644 --- a/test/files/run/transform.scala +++ b/test/files/run/transform.scala @@ -1,6 +1,6 @@ object Test { val x = (1 to 10).toBuffer - + def main(args: Array[String]): Unit = { x transform (_ * 2) assert(x.sum == (1 to 10).sum * 2) diff --git a/test/files/run/transpose.scala b/test/files/run/transpose.scala index 3bea74b365..2761a24ff5 100644 --- a/test/files/run/transpose.scala +++ b/test/files/run/transpose.scala @@ -1,8 +1,8 @@ object Test { - def wrap[T >: Null](body: => T) = + def wrap[T >: Null](body: => T) = try body catch { case _: IllegalArgumentException => null } - + def main(args: Array[String]): Unit = { assert(wrap(Nil.transpose) == Nil) assert(wrap(List(List(1, 2), List(1)).transpose) == null) diff --git a/test/files/run/triemap-hash.scala b/test/files/run/triemap-hash.scala index 7f19997da0..f9913816d4 100644 --- a/test/files/run/triemap-hash.scala +++ b/test/files/run/triemap-hash.scala @@ -6,41 +6,41 @@ import util.hashing.Hashing object Test { - + def main(args: Array[String]) { hashing() equality() } - + def hashing() { import collection._ - + val tm = new concurrent.TrieMap[String, String](Hashing.fromFunction(x => x.length + x(0).toInt), Equiv.universal) tm.put("a", "b") tm.put("c", "d") - + assert(tm("a") == "b") assert(tm("c") == "d") - + for (i <- 0 until 1000) tm(i.toString) = i.toString for (i <- 0 until 1000) assert(tm(i.toString) == i.toString) } - + def equality() { import collection._ - + val tm = new concurrent.TrieMap[String, String](Hashing.fromFunction(x => x(0).toInt), Equiv.fromFunction(_(0) == _(0))) tm.put("a", "b") tm.put("a1", "d") tm.put("b", "c") - + assert(tm("a") == "d", tm) assert(tm("b") == "c", tm) - + for (i <- 0 until 1000) tm(i.toString) = i.toString assert(tm.size == 12, tm) assert(tm("0") == "0", tm) for (i <- 1 to 9) assert(tm(i.toString) == i.toString + "99", tm) } - + } diff --git a/test/files/run/triple-quoted-expr.scala b/test/files/run/triple-quoted-expr.scala index 0b30946de2..6d91ac5888 100644 --- a/test/files/run/triple-quoted-expr.scala +++ b/test/files/run/triple-quoted-expr.scala @@ -1,18 +1,18 @@ class A { def f1 = { val x = 5 - + """ hi""" } def f2 = { val x = 5 - + """hi""" - } + } def f3 = { val x = 5 - + "\nhi" } } diff --git a/test/files/run/tuple-match.scala b/test/files/run/tuple-match.scala index 57ba9cf6e1..fcaefbff5b 100644 --- a/test/files/run/tuple-match.scala +++ b/test/files/run/tuple-match.scala @@ -1,7 +1,7 @@ object Test { val FOUR = (-1, -2, -3, "bingo donkey vegas") val THREE = (-1, -2, -3) - + def f(x: Any) = x match { case FOUR => "FOUR" case (_, _, 3, _) => "4, #3" @@ -13,7 +13,7 @@ object Test { case (_, 2) => "2, #2" case _ => "default" } - + def main(args: Array[String]): Unit = { println(f((1, 2, 3, 4))) println(f((1, 2, 30, 4))) diff --git a/test/files/run/tuple-zipped.scala b/test/files/run/tuple-zipped.scala index c8ba41f042..37ac52977f 100644 --- a/test/files/run/tuple-zipped.scala +++ b/test/files/run/tuple-zipped.scala @@ -11,32 +11,31 @@ object Test { val as1 = 1 to 100 toArray val as2 = as1.view val as3 = as1 take 10 - + def xss1 = List[Seq[Int]](xs1, xs2, xs3, ss1, ss2, ss3, as1, as2, as3) def xss2 = List[Seq[Int]](xs1, xs2, xs3, ss3, as1, as2, as3) // no infinities def xss3 = List[Seq[Int]](xs2, xs3, ss3, as1) // representative sampling - + def main(args: Array[String]): Unit = { for (cc1 <- xss1 ; cc2 <- xss2) { val sum1 = (cc1, cc2).zipped map { case (x, y) => x + y } sum val sum2 = (cc1, cc2).zipped map (_ + _) sum - + assert(sum1 == sum2) } - + for (cc1 <- xss1 ; cc2 <- xss2 ; cc3 <- xss3) { val sum1 = (cc1, cc2, cc3).zipped map { case (x, y, z) => x + y + z } sum val sum2 = (cc1, cc2, cc3).zipped map (_ + _ + _) sum - + assert(sum1 == sum2) } - + assert((ss1, ss1).zipped exists ((x, y) => true)) assert((ss1, ss1, ss1).zipped exists ((x, y, z) => true)) - + assert(!(ss1, ss2, 1 to 3).zipped.exists(_ + _ + _ > 100000)) assert((1 to 3, ss1, ss2).zipped.forall(_ + _ + _ > 0)) assert((ss1, 1 to 3, ss2).zipped.map(_ + _ + _).size == 3) } } - diff --git a/test/files/run/type-currying.scala b/test/files/run/type-currying.scala index 5e31fef403..e10f8fc9f1 100644 --- a/test/files/run/type-currying.scala +++ b/test/files/run/type-currying.scala @@ -36,10 +36,10 @@ object Test { val immutableBippy = Partial[immutable.HashMap].values[Int] def make[T](xs: T*) = immutableBippy[T] ++ xs.zipWithIndex - + val n0 = Partial[immutable.HashMap][String][Int] ++ Seq(("a", 1)) val n1 = Partial.apply[immutable.HashMap].apply[String].apply[Int] ++ Seq(("a", 1)) - + def main(args: Array[String]): Unit = { println(mutableBippy) make('a' to 'z': _*).toList.sorted foreach println diff --git a/test/files/run/typealias_overriding.scala b/test/files/run/typealias_overriding.scala index 8a2d1312ab..4b6a0037ec 100644 --- a/test/files/run/typealias_overriding.scala +++ b/test/files/run/typealias_overriding.scala @@ -1,21 +1,21 @@ // this bug (http://scala-webapps.epfl.ch/bugtracking/bugs/displayItem.do?id=1065) -// was caused by Uncurry not normalizing all the types +// was caused by Uncurry not normalizing all the types // (more specifically the argument/return types of an anonymous Function) object Test extends App { trait AddRemove { type TNode <: NodeImpl; trait NodeImpl; - + object removing { type TNode = AddRemove.this.TNode; def printNode(node: TNode, f: TNode => String) = Console.println(f(node)) } } - + class Linked extends AddRemove { type TNode = Node // can also directly write `class Node extends super.NodeImpl' -- doesn't change the bug class Node extends super.NodeImpl { override def toString = "LinkedNode" } - + removing.printNode(new Node, (x: removing.TNode) => x.toString) // make inference explicit, doesn't affect the bug } diff --git a/test/files/run/unapply.scala b/test/files/run/unapply.scala index 90dd4fae73..0c5a70e768 100644 --- a/test/files/run/unapply.scala +++ b/test/files/run/unapply.scala @@ -22,7 +22,7 @@ object Faa { def unapply(x: Any): Option[String] = if(x.isInstanceOf[Bar]) Some(x.asInstanceOf[Bar].name) else None } object FaaPrecise { - def unapply(x: Bar): Option[String] = Some(x.name) + def unapply(x: Bar): Option[String] = Some(x.name) } object FaaPreciseSome { def unapply(x: Bar) = Some(x.name) // return type Some[String] @@ -108,14 +108,14 @@ object Test1256 { class Sync { def unapply(scrut: Any): Boolean = false } - + class Buffer { val Get = new Sync val jp: PartialFunction[Any, Any] = { case Get() => } } - + def run() { assert(!(new Buffer).jp.isDefinedAt(42)) } diff --git a/test/files/run/unittest_collection.scala b/test/files/run/unittest_collection.scala index 3639b496b3..822e2b0c98 100644 --- a/test/files/run/unittest_collection.scala +++ b/test/files/run/unittest_collection.scala @@ -12,7 +12,7 @@ object Test { } def test(x: Buffer[String]) { - // testing method += + // testing method += x += "one" assert(x(0) == "one", "retrieving 'one'") assert(x.length == 1, "length A") @@ -25,10 +25,10 @@ object Test { assert(x.length == 1, "length C") - try { x(1); sys.error("no exception for removed element") } + try { x(1); sys.error("no exception for removed element") } catch { case i:IndexOutOfBoundsException => } - try { x.remove(1); sys.error("no exception for removed element") } + try { x.remove(1); sys.error("no exception for removed element") } catch { case i:IndexOutOfBoundsException => } x += "two2" diff --git a/test/files/run/unittest_iterator.scala b/test/files/run/unittest_iterator.scala index 89ccdb9d58..21dc64c3c5 100644 --- a/test/files/run/unittest_iterator.scala +++ b/test/files/run/unittest_iterator.scala @@ -1,5 +1,5 @@ // Some iterator grouped/sliding unit tests -object Test { +object Test { def it = (1 to 10).iterator def assertThat[T](expectedLength: Int, expectedLast: Seq[T])(it: Iterator[Seq[T]]) { val xs = it.toList @@ -7,15 +7,15 @@ object Test { assert(xs.size == expectedLength, fail("expected length " + expectedLength)) assert(xs.last == expectedLast, fail("expected last " + expectedLast)) } - + def main(args: Array[String]): Unit = { val itSum = it.toStream.sum for (i <- it) { // sum of the groups == sum of the original val thisSum = ((it grouped i) map (_.sum)).toStream.sum - assert(thisSum == itSum, thisSum + " != " + itSum) + assert(thisSum == itSum, thisSum + " != " + itSum) } - + // grouped assertThat(4, List(10)) { it grouped 3 } assertThat(3, List(7, 8, 9)) { it grouped 3 withPartial false } @@ -32,11 +32,11 @@ object Test { assertThat(1, (1 to 8).toList) { it.sliding(8, 8) withPartial false } assertThat(2, List(9, 10, -1, -1, -1)) { it.sliding(5, 8) withPadding -1 } assertThat(1, (1 to 5).toList) { it.sliding(5, 8) withPartial false } - + // larger step than window assertThat(5, List(9)) { it.sliding(1, 2) } assertThat(3, List(9, 10)) { it.sliding(2, 4) } - + // make sure it throws past the end val thrown = try { val it = List(1,2,3).sliding(2) diff --git a/test/files/run/unreachable.scala b/test/files/run/unreachable.scala index 99ac730746..bb907c92bf 100644 --- a/test/files/run/unreachable.scala +++ b/test/files/run/unreachable.scala @@ -66,7 +66,7 @@ object Test extends App { return 42 } catch { case x: Throwable => return 2 - } + } return 3 } @@ -75,7 +75,7 @@ object Test extends App { error("haha") } catch { case x: Throwable => return 42 - } + } return 3 } diff --git a/test/files/run/vector1.scala b/test/files/run/vector1.scala index 2e335aded4..d536183961 100644 --- a/test/files/run/vector1.scala +++ b/test/files/run/vector1.scala @@ -9,7 +9,7 @@ import scala.collection.mutable.Builder object Test { - + def vector(label: String, n: Int): Vector[String] = { val a = new VectorBuilder[String] for (i <- 0 until n) @@ -67,7 +67,7 @@ object Test { def test1() = { println("===== test1 =====") - + val N = 150000 val a = vector("a", N) val b = vectorForward("b", N) @@ -81,22 +81,22 @@ object Test { println("===== test2 =====") var a: Vector[String] = Vector.empty - + val rand = new java.util.Random - + val N = 150000 var min = N/2//rand.nextInt(N) var max = min - + val chunkLimit = 11 - + def nextChunkSize = 3 //rand.nextInt(chunkLimit) - + def seqBack() = for (i <- 0 until Math.min(nextChunkSize, N-max)) { a = a :+ ("a"+max); max += 1 } def seqFront() = for (i <- 0 until Math.min(nextChunkSize, min)) { min -= 1; a = ("a"+min) +: a } - + try { - + while (min > 0 || max < N) { seqFront() seqBack() @@ -107,7 +107,7 @@ object Test { //a.debug throw ex } - + assertVector(a, "a", 0, N) } @@ -122,14 +122,14 @@ object Test { val pos = scala.util.Random.shuffle(scala.collection.mutable.WrappedArray.make[Int](Array.tabulate[Int](N)(i => i))) var b = a - + { var i = 0 while (i < N) { b = b.updated(pos(i), "b"+(pos(i))) i += 1 } - + assertVector(b, "b", 0, N) } diff --git a/test/files/run/view-headoption.scala b/test/files/run/view-headoption.scala index 629b974c19..659c7e6b82 100644 --- a/test/files/run/view-headoption.scala +++ b/test/files/run/view-headoption.scala @@ -2,13 +2,13 @@ object Test { val failer = () => { println("fail") ; None } val succeeder = () => { println("success") ; Some(5) } val fs = List(failer, succeeder, failer, failer, succeeder, failer, failer, failer, succeeder) - + def f0 = fs.view flatMap (f => f()) def f1 = f0.headOption def f2 = f0.head def f3 = f0.lastOption def f4 = f0.last - + def main(args: Array[String]): Unit = { println("f1: " + f1) println("f2: " + f2) diff --git a/test/files/run/view-iterator-stream.scala b/test/files/run/view-iterator-stream.scala index c172b5cb99..0e0c42d7d3 100644 --- a/test/files/run/view-iterator-stream.scala +++ b/test/files/run/view-iterator-stream.scala @@ -21,7 +21,7 @@ object Test { } def and(g: Perturber): Perturber = new Perturber(this.labels ++ g.labels, f andThen g.f) - + override def toString = labels mkString " -> " } object Perturber { @@ -42,14 +42,14 @@ object Test { "slice(%d, %d)".format(from, until), _.toTraversable.slice(from, until) ) - + val fns = List[Perturber](toV, toI, toS, toIS) def tds(n: Int): Perturber = p(drop(n), take(n / 2), slice(1, n / 4)) def dts(n: Int): Perturber = p(take(n), drop(n / 2), slice(1, n / 4)) def sdt(n: Int): Perturber = p(slice(n, n * 2), drop(n / 2), take(n / 4)) def std(n: Int): Perturber = p(slice(n, n * 2), take(n / 2), drop(n / 4)) - + val transforms = (fns.permutations map (xs => p(xs take 3: _*))).toList.distinct def mkOps(n: Int) = List[Perturber](tds(n), dts(n), sdt(n), std(n)) def runOps(n: Int) = { @@ -63,7 +63,7 @@ object Test { } () } - + def main(args: Array[String]): Unit = { runOps(20) } diff --git a/test/files/run/viewtest.scala b/test/files/run/viewtest.scala index bb2c28d68a..581958e9a6 100755 --- a/test/files/run/viewtest.scala +++ b/test/files/run/viewtest.scala @@ -25,8 +25,8 @@ object Test extends App { 2.8 regression: CCE when zipping list projection with stream Reported by: szeiger Owned by: odersky Priority: normal Component: Standard Library -Keywords: collections, zip Cc: -Fixed in version: +Keywords: collections, zip Cc: +Fixed in version: Description Welcome to Scala version 2.8.0.r18784-b20090925021043 (Java HotSpot(TM) Client VM, Java 1.6.0_11). diff --git a/test/files/run/virtpatmat_apply.scala b/test/files/run/virtpatmat_apply.scala index 34cb80e449..b8776f4afb 100644 --- a/test/files/run/virtpatmat_apply.scala +++ b/test/files/run/virtpatmat_apply.scala @@ -1,5 +1,5 @@ object Test extends App { - List(1, 2, 3) match { + List(1, 2, 3) match { case Nil => println("FAIL") case x :: y :: xs if xs.length == 2 => println("FAIL") case x :: y :: xs if xs.length == 1 => println("OK "+ y) diff --git a/test/files/run/virtpatmat_casting.scala b/test/files/run/virtpatmat_casting.scala index 22ac29bc3b..a36daec6fb 100644 --- a/test/files/run/virtpatmat_casting.scala +++ b/test/files/run/virtpatmat_casting.scala @@ -1,7 +1,7 @@ object Test extends App { - println(List(1,2,3) match { - case Nil => List(0) -// since the :: extractor's argument must be a ::, there has to be a cast before its unapply is invoked + println(List(1,2,3) match { + case Nil => List(0) +// since the :: extractor's argument must be a ::, there has to be a cast before its unapply is invoked case x :: y :: z :: a :: xs => xs ++ List(x) case x :: y :: z :: xs => xs ++ List(x) case _ => List(0) diff --git a/test/files/run/virtpatmat_literal.scala b/test/files/run/virtpatmat_literal.scala index 5bd6b30791..9a68d296b5 100644 --- a/test/files/run/virtpatmat_literal.scala +++ b/test/files/run/virtpatmat_literal.scala @@ -1,22 +1,22 @@ object Test extends App { val a = 1 - 1 match { - case 2 => println("FAILED") - case 1 => println("OK") - case `a` => println("FAILED") + 1 match { + case 2 => println("FAILED") + case 1 => println("OK") + case `a` => println("FAILED") } val one = 1 - 1 match { - case 2 => println("FAILED") - case `one` => println("OK") - case 1 => println("FAILED") + 1 match { + case 2 => println("FAILED") + case `one` => println("OK") + case 1 => println("FAILED") } - 1 match { - case 2 => println("FAILED") - case Test.one => println("OK") - case 1 => println("FAILED") + 1 match { + case 2 => println("FAILED") + case Test.one => println("OK") + case 1 => println("FAILED") } }
\ No newline at end of file diff --git a/test/files/run/virtpatmat_switch.scala b/test/files/run/virtpatmat_switch.scala index 1329c19d0f..2f2e210d9e 100644 --- a/test/files/run/virtpatmat_switch.scala +++ b/test/files/run/virtpatmat_switch.scala @@ -4,11 +4,11 @@ object Test extends App { case 1 => "one" case _ => "many" } - + println(intSwitch(0)) println(intSwitch(1)) println(intSwitch(10)) - + def charSwitch(x: Char) = x match { case 'a' => "got a" case 'b' => "got b" @@ -20,15 +20,15 @@ object Test extends App { case 'b' => "got b" case _ => "got some letter" } - + println(charSwitch('a')) println(byteSwitch('b')) println(charSwitch('z')) - + def implicitDefault(x: Int) = x match { case 0 => 0 } - + try { implicitDefault(5) } catch { diff --git a/test/files/run/virtpatmat_typed.check b/test/files/run/virtpatmat_typed.check index 9924d84148..b304fa5ffc 100644 --- a/test/files/run/virtpatmat_typed.check +++ b/test/files/run/virtpatmat_typed.check @@ -1,4 +1,4 @@ virtpatmat_typed.scala:5: warning: unreachable code - case x: String => println("FAILED") + case x: String => println("FAILED") ^ OK foo diff --git a/test/files/run/virtpatmat_typed.scala b/test/files/run/virtpatmat_typed.scala index a9863cc48a..cdd6d3c749 100644 --- a/test/files/run/virtpatmat_typed.scala +++ b/test/files/run/virtpatmat_typed.scala @@ -1,7 +1,7 @@ object Test extends App { - ("foo": Any) match { - case x: Int => println("FAILED") - case x: String => println("OK "+ x) - case x: String => println("FAILED") + ("foo": Any) match { + case x: Int => println("FAILED") + case x: String => println("OK "+ x) + case x: String => println("FAILED") } }
\ No newline at end of file diff --git a/test/files/run/virtpatmat_unapply.scala b/test/files/run/virtpatmat_unapply.scala index 6d7b4dbe68..a6e71f3963 100644 --- a/test/files/run/virtpatmat_unapply.scala +++ b/test/files/run/virtpatmat_unapply.scala @@ -6,12 +6,12 @@ object IntList { } object Test extends App { - IntList(1, IntList(2, NilIL)) match { + IntList(1, IntList(2, NilIL)) match { case IntList(a1, IntList(a2, IntList(a3, y))) => println(a1 + a2 + a3) case IntList(x, y) => println(x) } - IntList(1, IntList(2, IntList(3, NilIL))) match { + IntList(1, IntList(2, IntList(3, NilIL))) match { case IntList(a1, IntList(a2, IntList(a3, y))) => println(a1 + a2 + a3) case IntList(x, y) => println(x) } @@ -20,12 +20,12 @@ object Test extends App { // ((x1: IntList) => IntList.unapply(x1).flatMap(((x4: (Int, IntList)) => IntList.unapply(x4._2).flatMap(((x5: (Int, IntList)) => IntList.unapply(x5._2).flatMap(((x6: (Int, IntList)) => implicitly[Predef.MatchingStrategy[Option]].success(Predef.println(x4._1.+(x5._1).+(x6._1))))))))).orElse(IntList.unapply(x1).flatMap(((x7: (Int, IntList)) => implicitly[scala.Predef.MatchingStrategy[Option]].success(Predef.println(x7._1))))).orElse(implicitly[scala.Predef.MatchingStrategy[Option]].fail))(IntList.apply(1, IntList.apply(2, IntList.apply(3, null)))) /* - ((x1: IntList) => - IntList.this.unapply(x1).flatMap[Int](((x4: (Int, IntList)) => - IntList.this.unapply(x4._2).flatMap[Int](((x5: (Int, IntList)) => - IntList.this.unapply(x5._2).flatMap[Int](((x6: (Int, IntList)) => + ((x1: IntList) => + IntList.this.unapply(x1).flatMap[Int](((x4: (Int, IntList)) => + IntList.this.unapply(x4._2).flatMap[Int](((x5: (Int, IntList)) => + IntList.this.unapply(x5._2).flatMap[Int](((x6: (Int, IntList)) => Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).success[Int](x6._1))))))).orElse[Int]( - IntList.this.unapply(x1).flatMap[Int](((x7: (Int, IntList)) => + IntList.this.unapply(x1).flatMap[Int](((x7: (Int, IntList)) => Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).success[Int](x7._1)))).orElse[Int]( Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).fail) ).apply(IntList.apply(1, null)) |