diff options
author | mihaylov <mihaylov@epfl.ch> | 2006-11-01 16:03:28 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2006-11-01 16:03:28 +0000 |
commit | 257a1845d3db3477a0b5939e94d77b0495d89561 (patch) | |
tree | 0aedf35621282407918e0f56b3b5ffc0952e6a14 /test/files/run | |
parent | 8b0cd5cf7c2a682dd70d6b8ea32b521015bf2269 (diff) | |
download | scala-257a1845d3db3477a0b5939e94d77b0495d89561.tar.gz scala-257a1845d3db3477a0b5939e94d77b0495d89561.tar.bz2 scala-257a1845d3db3477a0b5939e94d77b0495d89561.zip |
Refactored portability support
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/Course-2002-10.scala | 14 | ||||
-rw-r--r-- | test/files/run/bugs.scala | 8 | ||||
-rw-r--r-- | test/files/run/caseclasses.scala | 1 | ||||
-rw-r--r-- | test/files/run/lisp.scala | 8 | ||||
-rw-r--r-- | test/files/run/misc.scala | 4 |
5 files changed, 18 insertions, 17 deletions
diff --git a/test/files/run/Course-2002-10.scala b/test/files/run/Course-2002-10.scala index cfd4f02e99..258b6dc8fd 100644 --- a/test/files/run/Course-2002-10.scala +++ b/test/files/run/Course-2002-10.scala @@ -3,6 +3,8 @@ //############################################################################ // $Id$ +import compat.Math.{PI, log} + object M0 { def addStream (s1: Stream[int], s2: Stream[int]): Stream[int] = @@ -72,9 +74,9 @@ object M1 { i = i + 1; } Console.print("pi = "); - Console.print(str(Math.PI) + ", "); - Console.print(str(Math.PI) + ", "); - Console.print(str(Math.PI) + "\n"); + Console.print(str(PI) + ", "); + Console.print(str(PI) + ", "); + Console.print(str(PI) + "\n"); Console.println; i = 0; while (i < 10) { @@ -85,9 +87,9 @@ object M1 { i = i + 1; } Console.print("ln = "); - Console.print(str(Math.log(2)) + ", "); - Console.print(str(Math.log(2)) + ", "); - Console.print(str(Math.log(2)) + "\n"); + Console.print(str(log(2)) + ", "); + Console.print(str(log(2)) + ", "); + Console.print(str(log(2)) + "\n"); Console.println; } } diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index 6d0075332d..0f77bd5f34 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -169,7 +169,7 @@ trait Bug176A { def test = foo(bar); } trait Bug176B { - type S <: Object; + type S <: AnyRef; type T = S; def foo(x: S): Int; def bar: S; @@ -215,13 +215,13 @@ object Bug213Test { try { foo.testAll; } catch { - case e: compat.Platform.ClassCastException => + case e: ClassCastException => Console.println("Cannot cast unit to Nothing"); } try { foo.testAllRef; } catch { - case e: compat.Platform.ClassCastException => + case e: ClassCastException => Console.println("Cannot cast empty string to Null"); } () @@ -445,7 +445,7 @@ object Test { test; } catch { case exception => { - val curr: String = compat.Platform.currentThread.toString(); + val curr: String = currentThread.toString(); Console.print("Exception in thread \"" + curr + "\" " + exception); Console.println; errors = errors + 1; diff --git a/test/files/run/caseclasses.scala b/test/files/run/caseclasses.scala index 809bfb3511..7b9aa2e582 100644 --- a/test/files/run/caseclasses.scala +++ b/test/files/run/caseclasses.scala @@ -3,7 +3,6 @@ case class Foo(x: int)(y: int); case class Bar; object Test extends Application { - import compat.Platform.IndexOutOfBoundsException def fn[a,b](x: a => b) = x; val f = fn(Foo(1)) diff --git a/test/files/run/lisp.scala b/test/files/run/lisp.scala index bf895f2349..8a559bc813 100644 --- a/test/files/run/lisp.scala +++ b/test/files/run/lisp.scala @@ -240,7 +240,7 @@ object LispCaseClasses extends Lisp { if (token == "(") parseList else if (token == ")") error("unbalanced parentheses") else if ('0' <= token.charAt(0) && token.charAt(0) <= '9') - NUM(compat.Platform.parseInt(token)) + NUM(token.toInt) else if (token.charAt(0) == '\"' && token.charAt(token.length()-1)=='\"') STR(token.substring(1,token.length() - 1)) else SYM(token) @@ -432,8 +432,8 @@ object LispAny extends Lisp { if (token == "(") parseList else if (token == ")") error("unbalanced parentheses") //else if (Character.isDigit(token.charAt(0))) - else if (compat.Platform.isDigit(token.charAt(0))) - compat.Platform.parseInt(token) + else if (token.charAt(0).isDigit) + token.toInt else if (token.charAt(0) == '\"' && token.charAt(token.length()-1)=='\"') token.substring(1,token.length() - 1) else Symbol(token) @@ -457,7 +457,7 @@ class LispUser(lisp: Lisp) { def run = { - Console.println(string2lisp("(lambda (x) (+ (* x x) 1))").asInstanceOf[Object]); + Console.println(string2lisp("(lambda (x) (+ (* x x) 1))").asInstanceOf[AnyRef]); Console.println(lisp2string(string2lisp("(lambda (x) (+ (* x x) 1))"))); Console.println; diff --git a/test/files/run/misc.scala b/test/files/run/misc.scala index bff24ae0ee..7838328d4b 100644 --- a/test/files/run/misc.scala +++ b/test/files/run/misc.scala @@ -25,9 +25,9 @@ def id[X](x: X): X = x; def apply[X](f: X => X, x: X): X = f(x); -def id_obj(x: Object): Object = x; +def id_obj(x: AnyRef): AnyRef = x; -def apply_obj(f: Object => Object, x: Object): Object = f(x); +def apply_obj(f: AnyRef => AnyRef, x: AnyRef): AnyRef = f(x); def id_any(x: scala.Any): scala.Any = x; |