diff options
author | Martin Odersky <odersky@gmail.com> | 2003-08-04 15:36:09 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2003-08-04 15:36:09 +0000 |
commit | 5cbecc3b89757f6996c199e73518b8387d4a5a6a (patch) | |
tree | 83d6522f8172b62e0bced4c4c312c16939d69f6f /test/files | |
parent | f014b416aa6099f9031f60f1ccdb19a9ced74382 (diff) | |
download | scala-5cbecc3b89757f6996c199e73518b8387d4a5a6a.tar.gz scala-5cbecc3b89757f6996c199e73518b8387d4a5a6a.tar.bz2 scala-5cbecc3b89757f6996c199e73518b8387d4a5a6a.zip |
*** empty log message ***
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/pos/exceptions.scala | 2 | ||||
-rw-r--r-- | test/files/run/arrays.scala | 8 | ||||
-rw-r--r-- | test/files/run/iq.scala | 10 | ||||
-rw-r--r-- | test/files/run/lisp.scala | 27 |
4 files changed, 26 insertions, 21 deletions
diff --git a/test/files/pos/exceptions.scala b/test/files/pos/exceptions.scala index f28a10d367..2ba15efb4a 100644 --- a/test/files/pos/exceptions.scala +++ b/test/files/pos/exceptions.scala @@ -1,6 +1,6 @@ import java.io._; -object test { +object Test { //def error[a](x: String):a = new java.lang.RuntimeException(x) throw; diff --git a/test/files/run/arrays.scala b/test/files/run/arrays.scala index 8d375166d3..1100366392 100644 --- a/test/files/run/arrays.scala +++ b/test/files/run/arrays.scala @@ -96,8 +96,8 @@ object arrays { System.out.println(); zarray(0) = false; - barray(0) = 1 as Byte; - sarray(0) = 2 as Short; + barray(0) = 1.asInstanceOf[Byte]; + sarray(0) = 2.asInstanceOf[Short]; carray(0) ='3'; iarray(0) = 4; larray(0) = 5; @@ -106,8 +106,8 @@ object arrays { rarray(0) ="8"; zarray(1) = true; - barray(1) = 2 as Byte; - sarray(1) = 3 as Short; + barray(1) = 2.asInstanceOf[Byte]; + sarray(1) = 3.asInstanceOf[Short]; carray(1) ='4'; iarray(1) = 5; larray(1) = 6; diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala index f9c55476c7..cb18004ad2 100644 --- a/test/files/run/iq.scala +++ b/test/files/run/iq.scala @@ -43,11 +43,11 @@ object iq { */ java.lang.System.out.println("q5[5]: " + q5(5)); - val q5c:Queue[char] = Queue.Empty.enqueue(0 as char, 1 as char, - 2 as char, 3 as char, - 4 as char, 5 as char, - 6 as char, 7 as char, - 8 as char, 9 as char); + val q5c:Queue[char] = Queue.Empty.enqueue(0: char, 1: char, + 2: char, 3: char, + 4: char, 5: char, + 6: char, 7: char, + 8: char, 9: char); /* Testing == * Expected: q5 == q9: true * q9 == q5: true diff --git a/test/files/run/lisp.scala b/test/files/run/lisp.scala index c8c166a76c..2eb58528ab 100644 --- a/test/files/run/lisp.scala +++ b/test/files/run/lisp.scala @@ -288,18 +288,23 @@ object LispAny with Lisp { def lookup(n: String): Data = lispError("undefined: " + n); } - def asList(x: Data): List[Data] = - if (x is List[Data]) x as List[Data] - else lispError("malformed list: " + x); + def asList(x: Data): List[Data] = x match { + case y: List[Data] => y + case _ => lispError("malformed list: " + x) + } - def asBoolean(x: Data): boolean = - if (x == 0) false else true; + def asInt(x: Data): int = x match { + case y: int => y + case _ => lispError("not an integer: " + x) + } - def asInt(x: Data): int = - if (x is int) x as int else lispError("not an integer: " + x); + def asString(x: Data): String = x match { + case y: java.lang.String => y + case _ => lispError("not a string: " + x) + } - def asString(x: Data): String = - if (x is java.lang.String) x as java.lang.String else lispError("not a string: " + x); + def asBoolean(x: Data): boolean = + if (x == 0) false else true; def normalize(x: Data): Data = x match { case 'and :: x :: y :: Nil => @@ -368,7 +373,7 @@ object LispAny with Lisp { case y :: ys => " " + lisp2string(y) + list2string(ys) } "(" + lisp2string(y) + list2string(ys) + ")" - case _ => if (x is String) "\"" + x + "\""; else x.toString() + case _ => if (x.isInstanceOf[String]) "\"" + x + "\""; else x.toString() } def apply(fn: Data, args: List[Data]): Data = fn match { @@ -452,7 +457,7 @@ class LispUser(lisp: Lisp) { def run = { - System.out.println(string2lisp("(lambda (x) (+ (* x x) 1))") as Object); + System.out.println(string2lisp("(lambda (x) (+ (* x x) 1))").asInstanceOf[Object]); System.out.println(lisp2string(string2lisp("(lambda (x) (+ (* x x) 1))"))); System.out.println(); |