From f4267ccd96a9143c910c66a5b0436aaa64b7c9dc Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 18 Sep 2013 00:09:46 -0700 Subject: Cull extraneous whitespace. One last flurry with the broom before I leave you slobs to code in your own filth. Eliminated all the trailing whitespace I could manage, with special prejudice reserved for the test cases which depended on the preservation of trailing whitespace. Was reminded I cannot figure out how to eliminate the trailing space on the "scala> " prompt in repl transcripts. At least reduced the number of such empty prompts by trimming transcript code on the way in. Routed ConsoleReporter's "printMessage" through a trailing whitespace stripping method which might help futureproof against the future of whitespace diseases. Deleted the up-to-40 lines of trailing whitespace found in various library files. It seems like only yesterday we performed whitespace surgery on the whole repo. Clearly it doesn't stick very well. I suggest it would work better to enforce a few requirements on the way in. --- test/files/specialized/SI-7343.scala | 2 +- test/files/specialized/SI-7344.scala | 8 ++++---- test/files/specialized/arrays-traits.scala | 2 +- test/files/specialized/arrays.scala | 16 ++++++++-------- test/files/specialized/fft.scala | 26 +++++++++++++------------- test/files/specialized/spec-ame.scala | 10 +++++----- test/files/specialized/spec-hlists.scala | 4 ++-- test/files/specialized/spec-init.scala | 2 +- test/files/specialized/spec-matrix-old.scala | 12 ++++++------ test/files/specialized/spec-overrides.scala | 2 +- test/files/specialized/spec-patmatch.scala | 2 +- test/files/specialized/spec-super.scala | 6 +++--- test/files/specialized/spec-t3896.scala | 4 ++-- test/files/specialized/td3651.scala | 2 +- 14 files changed, 49 insertions(+), 49 deletions(-) (limited to 'test/files/specialized') diff --git a/test/files/specialized/SI-7343.scala b/test/files/specialized/SI-7343.scala index 5ee683064c..8d14a2c1c5 100644 --- a/test/files/specialized/SI-7343.scala +++ b/test/files/specialized/SI-7343.scala @@ -1,4 +1,4 @@ -class Parent[@specialized(Int) T] +class Parent[@specialized(Int) T] object Test extends App { diff --git a/test/files/specialized/SI-7344.scala b/test/files/specialized/SI-7344.scala index 1040460bd1..624adb6bbb 100644 --- a/test/files/specialized/SI-7344.scala +++ b/test/files/specialized/SI-7344.scala @@ -1,13 +1,13 @@ /* Test for SI-7344, where specialized methods inside the bodies of other * methods are not specialized, although they might as well be. The name - * for the specialized method should not be different depending on the + * for the specialized method should not be different depending on the * outside method/class' specialization. */ class Test[@specialized(Int, Double) X](val x: X) { def checkSpecialization[Y](@specialized(Int, Double) y: Y): X = { - // checking the specialization using the method name, which we can + // checking the specialization using the method name, which we can // extract from an exception's stack trace. We can match just the // prefix, since the compiler will add a suffix to the method name // during lambdalift, when it lifts the local methods outside. @@ -33,7 +33,7 @@ object Test extends App { val t2 = new Test(123) val t3 = new Test(1.3) - // we want specialization to rewire these, + // we want specialization to rewire these, // that's why they're not in a for loop: t1.checkSpecialization("x") @@ -49,5 +49,5 @@ object Test extends App { // t2.checkSpecialization(1.3) // t3.checkSpecialization("x") // t3.checkSpecialization(123) - // t3.checkSpecialization(1.3) + // t3.checkSpecialization(1.3) } diff --git a/test/files/specialized/arrays-traits.scala b/test/files/specialized/arrays-traits.scala index 34a1c37a01..9183d7a190 100644 --- a/test/files/specialized/arrays-traits.scala +++ b/test/files/specialized/arrays-traits.scala @@ -23,7 +23,7 @@ object Test { (new BaseS(new Array[String](1)): SuperS[String]).bar(new Array[String](1)) println(arrayApplyCount) println(arrayUpdateCount) - + (new BaseG(new Array[String](1)): SuperG[String]).foo println(arrayApplyCount) (new BaseG(new Array[String](1)): SuperG[String]).bar(new Array[String](1)) diff --git a/test/files/specialized/arrays.scala b/test/files/specialized/arrays.scala index c946a8fc55..505f482486 100644 --- a/test/files/specialized/arrays.scala +++ b/test/files/specialized/arrays.scala @@ -15,23 +15,23 @@ class Spec[@specialized(AnyRef) T](a: Array[T]) { object Test { - + def main(args: Array[String]) { val len = 50 - + testSpec(new Array[String](len)) println(arrayApplyCount) - + (new Spec(new Array[String](len)))() println(arrayApplyCount) - + testGeneric(new Array[String](len)) println(arrayApplyCount) - + (new Generic(new Array[String](len)))() println(arrayApplyCount) } - + def testGeneric[T](a: Array[T]) = { var i = 0 var sum = 0 @@ -41,7 +41,7 @@ object Test { } sum } - + def testSpec[@specialized(AnyRef) T](a: Array[T]) = { var i = 0 var sum = 0 @@ -51,5 +51,5 @@ object Test { } sum } - + } diff --git a/test/files/specialized/fft.scala b/test/files/specialized/fft.scala index 62a6a2abb9..76029832a9 100644 --- a/test/files/specialized/fft.scala +++ b/test/files/specialized/fft.scala @@ -1,13 +1,13 @@ /* * http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/dft/ - Modification of Paul Bourkes FFT code by Peter Cusack + Modification of Paul Bourkes FFT code by Peter Cusack to utilise the Microsoft complex type. - This computes an in-place complex-to-complex FFT + This computes an in-place complex-to-complex FFT x and y are the real and imaginary arrays of 2^m points. dir = 1 gives forward transform - dir = -1 gives reverse transform + dir = -1 gives reverse transform */ import Math.{sqrt, pow} @@ -24,19 +24,19 @@ object Test { x(j) = tmp } - def times(x: Complex, y: Complex): Complex = + def times(x: Complex, y: Complex): Complex = (x._1 * y._1 - x._2 * y._2, x._1 * y._2 + x._2 * y._1) - + def div(x: Complex, y: Complex): Complex = { val num = pow(y._1, 2) + pow(y._2, 2) ((x._1 * y._1 + x._2 * y._2)/num, (x._2 * y._1 - x._1 * y._2)/num) } - def div(x: Complex, y: Long) = + def div(x: Complex, y: Long) = (x._1 / y, x._2 / y) - def add(x: Complex, y: Complex) = + def add(x: Complex, y: Complex) = (x._1 + y._1, x._2 + y._2) def minus(x: Complex, y: Complex) = @@ -49,8 +49,8 @@ object Test { /*Calculate the number of points */ n = 1 - for (i <- 0l until m) - n <<= 1 + for (i <- 0l until m) + n <<= 1 /* Do the bit reversal */ i2 = n >> 1 @@ -86,7 +86,7 @@ object Test { for (i <- j.until(n, l2)) { i1 = i + l1; t1 = times(u, x(i1.toInt)) - x(i1.toInt) = minus(x(i.toInt), t1) + x(i1.toInt) = minus(x(i.toInt), t1) x(i.toInt) = add(x(i.toInt), t1) } @@ -97,7 +97,7 @@ object Test { c = (c._1, sqrt( (1.0 - c._1) / 2.0 )) // if (dir == 1) // c.imag(-c.imag()); - if (dir == 1) + if (dir == 1) c = (c._1, -c._2) // c.real(sqrt((1.0 + c.real()) / 2.0)); @@ -107,8 +107,8 @@ object Test { /* Scaling for forward transform */ if (dir == 1) { for (i <- 0l until n) - x(i.toInt) = div(x(i.toInt), n) - } + x(i.toInt) = div(x(i.toInt), n) + } } def run() { diff --git a/test/files/specialized/spec-ame.scala b/test/files/specialized/spec-ame.scala index 129fb9f447..017d5dfa37 100644 --- a/test/files/specialized/spec-ame.scala +++ b/test/files/specialized/spec-ame.scala @@ -1,13 +1,13 @@ // ticket #3432 object Test { trait B[@specialized(Int) T] { - def value: T + def value: T } - class A[@specialized(Int) T](x: T) { - def foo: B[T] = new B[T] { - def value = x - } + class A[@specialized(Int) T](x: T) { + def foo: B[T] = new B[T] { + def value = x + } } def main(args: Array[String]) { diff --git a/test/files/specialized/spec-hlists.scala b/test/files/specialized/spec-hlists.scala index 8c4ac8f610..82e3bf74c5 100644 --- a/test/files/specialized/spec-hlists.scala +++ b/test/files/specialized/spec-hlists.scala @@ -4,7 +4,7 @@ sealed trait HList { type Self <: HList - + type |: [E] = HCons[E, Self] final def |: [@specialized E](elem: E): |: [E] = new HCons[E, Self](elem, this.asInstanceOf[Self]) @@ -23,7 +23,7 @@ final object HNil extends HList { object Test extends App { val l1 = new HCons(42, "foo" |: HNil) println(l1.getClass) - + val l2 = 42 |: "abc" |: HNil println(l2.getClass) } diff --git a/test/files/specialized/spec-init.scala b/test/files/specialized/spec-init.scala index 5f27062ed2..94cd0ee82b 100644 --- a/test/files/specialized/spec-init.scala +++ b/test/files/specialized/spec-init.scala @@ -36,7 +36,7 @@ object Test { (new TouchGlobal(new Object)) Global.msg = "ok" // reset the value (new TouchGlobal(42)) - + println(runtime.BoxesRunTime.integerBoxCount) } } diff --git a/test/files/specialized/spec-matrix-old.scala b/test/files/specialized/spec-matrix-old.scala index 83941e80a7..4e3d3f1377 100644 --- a/test/files/specialized/spec-matrix-old.scala +++ b/test/files/specialized/spec-matrix-old.scala @@ -4,7 +4,7 @@ @deprecated("Suppress warnings", since="2.11") class Matrix[@specialized A: ClassManifest](val rows: Int, val cols: Int) { private val arr: Array[Array[A]] = Array.ofDim[A](rows, cols) - + def apply(i: Int, j: Int): A = { if (i < 0 || i >= rows || j < 0 || j >= cols) throw new NoSuchElementException("Indexes out of bounds: " + (i, j)) @@ -31,7 +31,7 @@ object Test { def main(args: Array[String]) { val m = randomMatrix(200, 100) val n = randomMatrix(100, 200) - + val p = mult(m, n) println(p(0, 0)) println("Boxed doubles: " + runtime.BoxesRunTime.doubleBoxCount) @@ -40,7 +40,7 @@ object Test { def randomMatrix(n: Int, m: Int) = { val r = new util.Random(10) - val x = new Matrix[Double](n, m) + val x = new Matrix[Double](n, m) for (i <- 0 until n; j <- 0 until m) x(i, j) = (r.nextInt % 1000).toDouble x @@ -48,7 +48,7 @@ object Test { def printMatrix[Double](m: Matrix[Double]) { for (i <- 0 until m.rows) { - for (j <- 0 until m.cols) + for (j <- 0 until m.cols) print("%5.3f ".format(m(i, j))) println } @@ -58,7 +58,7 @@ object Test { val p = new Matrix[T](m.rows, n.cols) import num._ - for (i <- 0 until m.rows) + for (i <- 0 until m.rows) for (j <- 0 until n.cols) { var sum = num.zero for (k <- 0 until n.rows) @@ -70,7 +70,7 @@ object Test { def mult(m: Matrix[Double], n: Matrix[Double]) = { val p = new Matrix[Double](m.rows, n.cols) - for (i <- 0 until m.rows) + for (i <- 0 until m.rows) for (j <- 0 until n.cols) { var sum = 0.0 for (k <- 0 until n.rows) diff --git a/test/files/specialized/spec-overrides.scala b/test/files/specialized/spec-overrides.scala index 90dd5a4e72..994dd9d245 100644 --- a/test/files/specialized/spec-overrides.scala +++ b/test/files/specialized/spec-overrides.scala @@ -17,6 +17,6 @@ object Test extends App { assert(d2.default == 1.0, d2.default) assert((d2: Base[_]).default == 1.0, (d2: Base[_]).default) assert((d2: D1).default == 1.0, (d2: D1).default) - + println(runtime.BoxesRunTime.integerBoxCount) } diff --git a/test/files/specialized/spec-patmatch.scala b/test/files/specialized/spec-patmatch.scala index 979d143fe2..909629455d 100644 --- a/test/files/specialized/spec-patmatch.scala +++ b/test/files/specialized/spec-patmatch.scala @@ -46,7 +46,7 @@ object Test { (new Foo).test(42.0) (new Foo).test(42.0f) (new Foo).test(new Object) - + println(runtime.BoxesRunTime.integerBoxCount) } diff --git a/test/files/specialized/spec-super.scala b/test/files/specialized/spec-super.scala index a77f65b2cf..056a7712f0 100644 --- a/test/files/specialized/spec-super.scala +++ b/test/files/specialized/spec-super.scala @@ -7,13 +7,13 @@ object Test { val i = new Extended(1) println(i.foo) //infinite loop with StackOverflowError - + println(runtime.BoxesRunTime.integerBoxCount) } } -class Base[@specialized(Int) T](val t: T) { - def foo() :T = t +class Base[@specialized(Int) T](val t: T) { + def foo() :T = t } class Extended [@specialized(Int) T](t: T) extends Base[T](t) { override def foo() :T = super.foo diff --git a/test/files/specialized/spec-t3896.scala b/test/files/specialized/spec-t3896.scala index 3a3be3da2b..3c849036c1 100644 --- a/test/files/specialized/spec-t3896.scala +++ b/test/files/specialized/spec-t3896.scala @@ -1,7 +1,7 @@ // see ticket #3896. Tests interaction between overloading, specialization and default params trait Atomic[@specialized(Boolean) T] { def x: T - + // crash depends on the overloading: if second method is "g", no crash. def f(fn: T => T): Boolean = f(fn(x)) def f[R](a: T, b: R = true) = b @@ -14,7 +14,7 @@ object Test { val x = e.f( (a : Boolean) => !a ) // ok println( e.f( (a : Boolean) => !a ).toString ) // ok println( e.f( (a : Boolean) => !a) ) // compiler crash - + println(runtime.BoxesRunTime.integerBoxCount) } } diff --git a/test/files/specialized/td3651.scala b/test/files/specialized/td3651.scala index 19a4ab616c..117710b6dc 100644 --- a/test/files/specialized/td3651.scala +++ b/test/files/specialized/td3651.scala @@ -11,7 +11,7 @@ object Test { val b: Base[Double] = new Derived(10) b.a println(runtime.BoxesRunTime.doubleBoxCount) - + val der = new Derived(10) der.a println(runtime.BoxesRunTime.doubleBoxCount) -- cgit v1.2.3