summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-06-05 15:57:59 +0000
committerMartin Odersky <odersky@gmail.com>2007-06-05 15:57:59 +0000
commite51207992f525ed9e32a7a9a39512b4d7e503c03 (patch)
treeb9440d03aed294fde3f8aaa293f60ed98b5de0c1 /test/files/run
parente060c61b6127ceb2de0e4ce5d3f3d685bc542804 (diff)
downloadscala-e51207992f525ed9e32a7a9a39512b4d7e503c03.tar.gz
scala-e51207992f525ed9e32a7a9a39512b4d7e503c03.tar.bz2
scala-e51207992f525ed9e32a7a9a39512b4d7e503c03.zip
deprecated &f, .f, requires.
Added existential types.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/Course-2002-02.scala12
-rw-r--r--test/files/run/amp.scala4
-rw-r--r--test/files/run/collections.scala8
-rw-r--r--test/files/run/ctor-order.scala2
-rw-r--r--test/files/run/imports.scala6
-rw-r--r--test/files/run/patmatnew.scala2
-rw-r--r--test/files/run/tuples.scala4
7 files changed, 19 insertions, 19 deletions
diff --git a/test/files/run/Course-2002-02.scala b/test/files/run/Course-2002-02.scala
index 9d8b8da389..e688850f9a 100644
--- a/test/files/run/Course-2002-02.scala
+++ b/test/files/run/Course-2002-02.scala
@@ -140,9 +140,9 @@ object M6 {
if (a > b) 0
else f(a) + sum(f)(a + 1, b);
- def sumInts = &sum(x => x)
- def sumCubes = &sum(x => x * x * x)
- def sumReciprocals = &sum(x => 1.0/x)
+ def sumInts = sum(x => x)_
+ def sumCubes = sum(x => x * x * x)_
+ def sumReciprocals = sum(x => 1.0/x)_
def sumPi = { n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n) }
Console.println(sumInts(1,4))
@@ -163,9 +163,9 @@ object M7 {
iter(a, 0)
}
- def sumInts = &sum(x => x)
- def sumCubes = &sum(x => x * x * x)
- def sumReciprocals = &sum(x => 1.0/x)
+ def sumInts = sum(x => x)_
+ def sumCubes = sum(x => x * x * x)_
+ def sumReciprocals = sum(x => 1.0/x)_
def sumPi = { n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n) }
Console.println(sumInts(1,4))
diff --git a/test/files/run/amp.scala b/test/files/run/amp.scala
index 62451b62ba..d46461ba20 100644
--- a/test/files/run/amp.scala
+++ b/test/files/run/amp.scala
@@ -2,12 +2,12 @@ object Test extends Application {
def foo() = {
def f: int = 1
- val x = &f
+ val x = f _
x
}
def bar(g: => int) = {
- &g
+ g _
}
Console.println((bar{ Console.println("g called"); 42 })())
diff --git a/test/files/run/collections.scala b/test/files/run/collections.scala
index f0a005d198..3f3bfb6b06 100644
--- a/test/files/run/collections.scala
+++ b/test/files/run/collections.scala
@@ -54,10 +54,10 @@ object Test extends Application {
var s = s0
s = s + (2 -> 2)
s = s + (3 -> 3, 4000 -> 4000, 10000 -> 10000)
- Console.println("test1: "+sum(s map (._2)))
+ Console.println("test1: "+sum(s map (_._2)))
time {
s = s ++ (List.range(0, iters) map (x => x * 2 -> x * 2))
- Console.println("test2: "+sum(s map (._2))+", iters = "+iters)
+ Console.println("test2: "+sum(s map (_._2))+", iters = "+iters)
}
time {
var x = 0
@@ -89,10 +89,10 @@ object Test extends Application {
var s = s0
s = s + (2 -> 2)
s = s + (3 -> 3, 4000 -> 4000, 10000 -> 10000)
- Console.println("test1: "+sum(s map (._2)))
+ Console.println("test1: "+sum(s map (_._2)))
time {
s = s ++ (List.range(0, iters) map (x => x * 2 -> x * 2))
- Console.println("test2: "+sum(s map (._2))+", iters = "+iters)
+ Console.println("test2: "+sum(s map (_._2))+", iters = "+iters)
}
time {
var x = 0
diff --git a/test/files/run/ctor-order.scala b/test/files/run/ctor-order.scala
index 53b580cb02..6201a4b70f 100644
--- a/test/files/run/ctor-order.scala
+++ b/test/files/run/ctor-order.scala
@@ -14,7 +14,7 @@ class Outer {
val outer = Outer.this;
}
- trait M1 requires X {
+ trait M1 { self: X =>
Console.println(global.x);
Console.println(outer.global.x);
}
diff --git a/test/files/run/imports.scala b/test/files/run/imports.scala
index d976478d8b..22e6fa9ca5 100644
--- a/test/files/run/imports.scala
+++ b/test/files/run/imports.scala
@@ -6,11 +6,11 @@
//############################################################################
object checker {
- def check(where: String, what: String, value: Any): Unit = {
- Console.print("In " + where + ", " + what + ".toString() returns ");
+ def check(location: String, what: String, value: Any): Unit = {
+ Console.print("In " + location + ", " + what + ".toString() returns ");
Console.flush;
val string: String = if (value == null) "null" else value.toString();
- val test = if (string == where) "ok" else "KO";
+ val test = if (string == location) "ok" else "KO";
Console.println(string + " -> " + test);
Console.flush;
}
diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala
index 4f6649f8b6..f8216177cd 100644
--- a/test/files/run/patmatnew.scala
+++ b/test/files/run/patmatnew.scala
@@ -1,4 +1,4 @@
-trait Treez requires Shmeez {
+trait Treez { self: Shmeez =>
abstract class Tree
case class Beez(i:Int) extends Tree
case object HagbardCeline extends Tree
diff --git a/test/files/run/tuples.scala b/test/files/run/tuples.scala
index 857b166917..b03167adee 100644
--- a/test/files/run/tuples.scala
+++ b/test/files/run/tuples.scala
@@ -13,9 +13,9 @@ object Test extends Application {
def params = (2, "xxx", 3.14159) // (*****)
- tupled(&func)(params) // call the function with all the params at once
+ tupled(func _)(params) // call the function with all the params at once
func(2, "xxx", 3.14159) // the same call
- (&func).apply(2, "xxx", 3.14159) // the same call
+ (func _).apply(2, "xxx", 3.14159) // the same call
// Composing a tuple
def t = (1, "Hello", false)