summaryrefslogtreecommitdiff
path: root/test/files/specialized
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@epfl.ch>2011-11-02 14:34:35 +0000
committerHubert Plociniczak <hubert.plociniczak@epfl.ch>2011-11-02 14:34:35 +0000
commitb6778be91900b8161e705dc2598ef7af86842b0b (patch)
treed15e8ec18a37eec212f50f1ace27714d7e7d4d34 /test/files/specialized
parentac6c76f26d884a94d0c9ff54f055d3f9ab750bac (diff)
downloadscala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.gz
scala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.bz2
scala-b6778be91900b8161e705dc2598ef7af86842b0b.zip
Begone t1737...
Diffstat (limited to 'test/files/specialized')
-rw-r--r--test/files/specialized/arrays-traits.scala6
-rw-r--r--test/files/specialized/arrays.scala16
-rw-r--r--test/files/specialized/fft.scala26
-rw-r--r--test/files/specialized/spec-ame.scala10
-rw-r--r--test/files/specialized/spec-init.scala2
-rw-r--r--test/files/specialized/spec-matrix.scala12
-rw-r--r--test/files/specialized/spec-overrides.scala2
-rw-r--r--test/files/specialized/spec-patmatch.scala2
-rw-r--r--test/files/specialized/spec-super.scala6
-rw-r--r--test/files/specialized/spec-t3896.scala4
-rw-r--r--test/files/specialized/td3651.scala2
11 files changed, 44 insertions, 44 deletions
diff --git a/test/files/specialized/arrays-traits.scala b/test/files/specialized/arrays-traits.scala
index ee62622635..de54d22d18 100644
--- a/test/files/specialized/arrays-traits.scala
+++ b/test/files/specialized/arrays-traits.scala
@@ -28,19 +28,19 @@ class BaseG[T](val arr: Array[T]) extends SuperG[T] {
object Test {
-
+
def main(args: Array[String]) {
(new BaseS(new Array[String](1)): SuperS[String]).foo
println(arrayApplyCount)
(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))
println(arrayApplyCount)
println(arrayUpdateCount)
}
-
+
}
diff --git a/test/files/specialized/arrays.scala b/test/files/specialized/arrays.scala
index 505f482486..c946a8fc55 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 76029832a9..62a6a2abb9 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 45e88266eb..79ee4217ed 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-init.scala b/test/files/specialized/spec-init.scala
index 94cd0ee82b..5f27062ed2 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.scala b/test/files/specialized/spec-matrix.scala
index 463a454692..98735c8c03 100644
--- a/test/files/specialized/spec-matrix.scala
+++ b/test/files/specialized/spec-matrix.scala
@@ -3,7 +3,7 @@
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))
@@ -29,7 +29,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)
@@ -38,7 +38,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
@@ -46,7 +46,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
}
@@ -56,7 +56,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)
@@ -68,7 +68,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 994dd9d245..90dd5a4e72 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 909629455d..979d143fe2 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 056a7712f0..a77f65b2cf 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 89326b4284..605ed0df9d 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 117710b6dc..19a4ab616c 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)