From 257a1845d3db3477a0b5939e94d77b0495d89561 Mon Sep 17 00:00:00 2001 From: mihaylov Date: Wed, 1 Nov 2006 16:03:28 +0000 Subject: Refactored portability support --- test/files/jvm/JavaInteraction.scala | 8 ++++---- test/files/jvm/bigints.scala | 11 +++++------ test/files/jvm5/attributes.scala | 2 ++ test/files/jvm5/bug676.scala | 2 +- test/files/jvm5/bug680.scala | 2 +- test/files/neg/bug421.scala | 2 +- test/files/neg/bug500.scala | 2 +- test/files/neg/bug501.scala | 2 +- test/files/neg/bug692.check | 2 +- test/files/neg/bug692.scala | 12 ++++++------ test/files/neg/bug779.scala | 2 +- test/files/neg/constrs.check | 4 ++-- test/files/neg/constrs.scala | 2 +- test/files/neg/forward.scala | 2 +- test/files/neg/viewtest.scala | 6 +++--- test/files/pos/Z.scala | 2 +- test/files/pos/abstract.scala | 2 +- test/files/pos/bug082.scala | 2 +- test/files/pos/bug1.scala | 8 -------- test/files/pos/bug115.scala | 2 +- test/files/pos/bug159.scala | 4 +++- test/files/pos/bug17.scala | 2 +- test/files/pos/bug193.scala | 10 +++++----- test/files/pos/bug20.scala | 4 ++-- test/files/pos/bug211.scala | 2 +- test/files/pos/bug267.scala | 2 +- test/files/pos/bug31.scala | 2 +- test/files/pos/bug32.scala | 4 ++-- test/files/pos/bug360.scala | 2 +- test/files/pos/bug374.scala | 2 +- test/files/pos/bug49.scala | 4 ++-- test/files/pos/bug516.scala | 4 ++-- test/files/pos/constfold.scala | 8 ++++---- test/files/pos/exceptions.scala | 8 ++++---- test/files/pos/functions.scala | 2 +- test/files/pos/gui.scala | 10 +++++----- test/files/pos/localmodules.scala | 4 ++-- test/files/pos/matthias4.scala | 8 ++++---- test/files/pos/michel2.scala | 6 +++--- test/files/pos/michel5.scala | 4 ++-- test/files/pos/override.scala | 6 +++--- test/files/pos/rebind.scala | 2 +- test/files/pos/seqtest2.scala | 2 +- test/files/pos/testcast.scala | 2 +- test/files/pos/thistype.scala | 4 ++-- test/files/pos/traits.scala | 6 ++---- test/files/pos/viewtest1.scala | 2 +- test/files/pos/viewtest2.scala | 6 +++--- test/files/run/Course-2002-10.scala | 14 ++++++++------ test/files/run/bugs.scala | 8 ++++---- test/files/run/caseclasses.scala | 1 - test/files/run/lisp.scala | 8 ++++---- test/files/run/misc.scala | 4 ++-- test/files/script/fact.scala | 2 +- 54 files changed, 115 insertions(+), 121 deletions(-) mode change 100755 => 100644 test/files/jvm5/bug680.scala delete mode 100644 test/files/pos/bug1.scala (limited to 'test') diff --git a/test/files/jvm/JavaInteraction.scala b/test/files/jvm/JavaInteraction.scala index ee86e83dbd..2728a5aee4 100644 --- a/test/files/jvm/JavaInteraction.scala +++ b/test/files/jvm/JavaInteraction.scala @@ -14,10 +14,10 @@ class ColoredPoint(x: Int, y: Int, c_ : Color) extends Point(x, y) { object Test { def main(args: Array[String]): Unit = { val p = new ColoredPoint(5, 7, Color.RED); - System.out.println("p.x = " + p.x); - System.out.println("p.c = " + p.c); - System.out.println("p.getX() = " + p.getX()); - System.out.println("p.getC() = " + p.getC()); + Console.println("p.x = " + p.x); + Console.println("p.c = " + p.c); + Console.println("p.getX() = " + p.getX()); + Console.println("p.getC() = " + p.getC()); } } diff --git a/test/files/jvm/bigints.scala b/test/files/jvm/bigints.scala index f1328274c6..627c81cbfc 100644 --- a/test/files/jvm/bigints.scala +++ b/test/files/jvm/bigints.scala @@ -4,11 +4,10 @@ object Test extends Application { val x: BigInt = 1 val y = x + 1 val z = 1 + y - System.out.println(z) - System.out.println(z <= 3) - System.out.println(3 < z) - System.out.println(z == 3) - System.out.println(3 == z) + Console.println(z) + Console.println(z <= 3) + Console.println(3 < z) + Console.println(z == 3) + Console.println(3 == z) } - diff --git a/test/files/jvm5/attributes.scala b/test/files/jvm5/attributes.scala index 051355a947..be949e25a9 100644 --- a/test/files/jvm5/attributes.scala +++ b/test/files/jvm5/attributes.scala @@ -1,3 +1,5 @@ +import java.lang.Deprecated + object Test1 { class Foo { [remote] diff --git a/test/files/jvm5/bug676.scala b/test/files/jvm5/bug676.scala index 2ca8083ceb..bcd27e4e21 100644 --- a/test/files/jvm5/bug676.scala +++ b/test/files/jvm5/bug676.scala @@ -3,6 +3,6 @@ object Test { import java.lang.annotation.Retention; val c = classOf[Retention] val r: Retention = c.getAnnotation(c).asInstanceOf[Retention]; - System.out.println(r.value) + Console.println(r.value) } } diff --git a/test/files/jvm5/bug680.scala b/test/files/jvm5/bug680.scala old mode 100755 new mode 100644 index d2c1744325..31c359ed8c --- a/test/files/jvm5/bug680.scala +++ b/test/files/jvm5/bug680.scala @@ -1,6 +1,6 @@ object Test { def main(args:Array[String]): unit = { - val sb = new StringBuilder() // use Java 1.5 + val sb = new java.lang.StringBuilder() // use Java 1.5 sb.setLength(0) } } diff --git a/test/files/neg/bug421.scala b/test/files/neg/bug421.scala index 3e014b7500..43f6c9dafd 100644 --- a/test/files/neg/bug421.scala +++ b/test/files/neg/bug421.scala @@ -1,5 +1,5 @@ object foo { - case class Bar(a:String, b:Object, c:String*); + case class Bar(a:String, b:AnyRef, c:String*); Bar("foo","meets","bar") match { case Bar("foo",_*) => error("huh?"); diff --git a/test/files/neg/bug500.scala b/test/files/neg/bug500.scala index d572cd8b80..d843d71f07 100644 --- a/test/files/neg/bug500.scala +++ b/test/files/neg/bug500.scala @@ -14,7 +14,7 @@ object Test { def main(args: Array[String]): Unit = { try { val i: Int = Magic.magic("42"); - System.out.println(i); + Console.println(i); } catch { case ex: Throwable => ex.printStackTrace() } diff --git a/test/files/neg/bug501.scala b/test/files/neg/bug501.scala index 454344974a..437ab8f21e 100644 --- a/test/files/neg/bug501.scala +++ b/test/files/neg/bug501.scala @@ -13,6 +13,6 @@ object Magic { object Test { def main(args: Array[String]): Unit = { val i: Int = Magic.magic("42"); - System.out.println(i); + Console.println(i); } } diff --git a/test/files/neg/bug692.check b/test/files/neg/bug692.check index afd2639123..2cd761b568 100644 --- a/test/files/neg/bug692.check +++ b/test/files/neg/bug692.check @@ -2,7 +2,7 @@ bug692.scala:3 error: not found: type T trait Type[T0] extends Type0[T]; ^ bug692.scala:10 error: class Foo takes type parameters - case class FooType extends ClassType[Foo,Object](ObjectType); + case class FooType extends ClassType[Foo,AnyRef](ObjectType); ^ bug692.scala:13 error: class Foo takes type parameters case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType); diff --git a/test/files/neg/bug692.scala b/test/files/neg/bug692.scala index 50976f1121..dc5a9040a0 100755 --- a/test/files/neg/bug692.scala +++ b/test/files/neg/bug692.scala @@ -1,13 +1,13 @@ abstract class test3 { trait Type0[+T0]; trait Type[T0] extends Type0[T]; - trait ClassType0[+C <: Object] extends Type0[C]; - abstract class RefType[C <: Object] extends Type[C]; - case class ObjectType extends RefType[Object]; - abstract class ClassType[C <: Z, Z <: Object](zuper : RefType[Z]) extends RefType[C]; + trait ClassType0[+C <: AnyRef] extends Type0[C]; + abstract class RefType[C <: AnyRef] extends Type[C]; + case class ObjectType extends RefType[AnyRef]; + abstract class ClassType[C <: Z, Z <: AnyRef](zuper : RefType[Z]) extends RefType[C]; - case class FooType extends ClassType[Foo,Object](ObjectType); + case class FooType extends ClassType[Foo,AnyRef](ObjectType); implicit def typeOfFoo = FooType(); case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType); @@ -15,6 +15,6 @@ abstract class test3 { BarType(elem); - class Foo[A <: Object]; + class Foo[A <: AnyRef]; class Bar[A <: Foo](implicit tpeA : Type[A]) extends Foo; } diff --git a/test/files/neg/bug779.scala b/test/files/neg/bug779.scala index 9179fab4f8..cc92f9062a 100644 --- a/test/files/neg/bug779.scala +++ b/test/files/neg/bug779.scala @@ -1,6 +1,6 @@ abstract class Foo { trait Node { - def ast: Object = null + def ast: AnyRef = null } trait Something extends Node { override def ast = return null diff --git a/test/files/neg/constrs.check b/test/files/neg/constrs.check index 4da2b16b3d..eae90b0163 100644 --- a/test/files/neg/constrs.check +++ b/test/files/neg/constrs.check @@ -1,8 +1,8 @@ constrs.scala:6 error: type T is not a member of object test - def this(y: int)(z: int)(t: this.T) = { this(this.u + y + z); System.out.println(x) } + def this(y: int)(z: int)(t: this.T) = { this(this.u + y + z); Console.println(x) } ^ constrs.scala:6 error: value u is not a member of object test - def this(y: int)(z: int)(t: this.T) = { this(this.u + y + z); System.out.println(x) } + def this(y: int)(z: int)(t: this.T) = { this(this.u + y + z); Console.println(x) } ^ constrs.scala:10 error: called constructor must precede calling constructor def this() = this("abc") diff --git a/test/files/neg/constrs.scala b/test/files/neg/constrs.scala index 5c4ac071e8..e425a25120 100644 --- a/test/files/neg/constrs.scala +++ b/test/files/neg/constrs.scala @@ -3,7 +3,7 @@ object test { abstract class Test(x: int) { type T; val u = x; - def this(y: int)(z: int)(t: this.T) = { this(this.u + y + z); System.out.println(x) } + def this(y: int)(z: int)(t: this.T) = { this(this.u + y + z); Console.println(x) } } class Foo(x: int) { diff --git a/test/files/neg/forward.scala b/test/files/neg/forward.scala index 5e21e4c1fe..b7f7a50583 100644 --- a/test/files/neg/forward.scala +++ b/test/files/neg/forward.scala @@ -18,7 +18,7 @@ object Test { } { def f: int = g; - System.out.println("foo"); + Console.println("foo"); def g: int = f; } } diff --git a/test/files/neg/viewtest.scala b/test/files/neg/viewtest.scala index 5a8abdccfd..da26ccbfad 100644 --- a/test/files/neg/viewtest.scala +++ b/test/files/neg/viewtest.scala @@ -96,21 +96,21 @@ object Test { for (val s <- args) { t = t insert s } - System.out.println(t.elements) + Console.println(t.elements) } { var t: Tree[Str] = Empty for (val s <- args) { t = t insert Str(s) } - System.out.println(t.elements) + Console.println(t.elements) } { var t: Tree[List[char]] = Empty for (val s <- args) { t = t insert toCharList(s) } - System.out.println(t.elements) + Console.println(t.elements) } } } diff --git a/test/files/pos/Z.scala b/test/files/pos/Z.scala index c1367e46b9..6a8e97ed1a 100644 --- a/test/files/pos/Z.scala +++ b/test/files/pos/Z.scala @@ -5,6 +5,6 @@ trait X { object test { def g(x: X) = x.elem; - def f(x: Object) = x.toString(); + def f(x: AnyRef) = x.toString(); } diff --git a/test/files/pos/abstract.scala b/test/files/pos/abstract.scala index 533f996931..2ac06e59bd 100644 --- a/test/files/pos/abstract.scala +++ b/test/files/pos/abstract.scala @@ -5,5 +5,5 @@ abstract class C() { class D() extends C() { type t = Int; - System.out.println(copy(1)); + Console.println(copy(1)); } diff --git a/test/files/pos/bug082.scala b/test/files/pos/bug082.scala index 594c9fdc86..a2a36bcd65 100644 --- a/test/files/pos/bug082.scala +++ b/test/files/pos/bug082.scala @@ -13,6 +13,6 @@ object Main { def min(xs: List[Int]) = min0((x: Int, y: Int) => x < y, xs); def main(args: Array[String]) = - System.out.println(min(List())); + Console.println(min(List())); } diff --git a/test/files/pos/bug1.scala b/test/files/pos/bug1.scala deleted file mode 100644 index bdf33ef20d..0000000000 --- a/test/files/pos/bug1.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Exceptions { - - class CubeException(s: String) extends java.lang.RuntimeException(s); - - def main(args: Array[String]) = - System.out.println(new CubeException("test")); - -} diff --git a/test/files/pos/bug115.scala b/test/files/pos/bug115.scala index ad6cb44497..e361f06370 100644 --- a/test/files/pos/bug115.scala +++ b/test/files/pos/bug115.scala @@ -1,5 +1,5 @@ class S[A](f: A => A, x: A) { - System.out.println(f(x)); + Console.println(f(x)); } class T[B](f: B => B, y: B) extends S((x: B) => f(x), y) { } diff --git a/test/files/pos/bug159.scala b/test/files/pos/bug159.scala index ef6eba5255..341cf07085 100644 --- a/test/files/pos/bug159.scala +++ b/test/files/pos/bug159.scala @@ -1,8 +1,10 @@ +import compat.StringBuilder + object foo { // the problem seems to appear only // if "val _" is in the body of a case - def cooked( ckd:StringBuffer ):Unit = + def cooked( ckd:StringBuilder ):Unit = 'a' match { case '-' => val _ = ckd.append( '_' ); diff --git a/test/files/pos/bug17.scala b/test/files/pos/bug17.scala index a83eefe972..d2bcda08d4 100644 --- a/test/files/pos/bug17.scala +++ b/test/files/pos/bug17.scala @@ -9,7 +9,7 @@ abstract class Constraint(q: Quantity) { } class Adder(q: Quantity) extends Constraint(q) { - def newValue = System.out.println(q.getValue); + def newValue = Console.println(q.getValue); } object Main { diff --git a/test/files/pos/bug193.scala b/test/files/pos/bug193.scala index 9b1c82f45f..e055f8a324 100644 --- a/test/files/pos/bug193.scala +++ b/test/files/pos/bug193.scala @@ -18,7 +18,7 @@ trait Test { () } - def fun_o0(x: Object): Unit = { + def fun_o0(x: AnyRef): Unit = { (x: Any) == 0; (x ) == 0; (x: Any) != 0; @@ -34,7 +34,7 @@ trait Test { () } - def fun_0o(y: Object): Unit = { + def fun_0o(y: AnyRef): Unit = { (0: Any) == y; (0 ) == y; (0: Any) != y; @@ -49,21 +49,21 @@ trait Test { (x ) != y; () } - def fun_io(x: Int, y: Object): Unit = { + def fun_io(x: Int, y: AnyRef): Unit = { (x: Any) == y; (x ) == y; (x: Any) != y; (x ) != y; () } - def fun_oi(x: Object, y: Int): Unit = { + def fun_oi(x: AnyRef, y: Int): Unit = { (x: Any) == y; (x ) == y; (x: Any) != y; (x ) != y; () } - def fun_oo(x: Object, y: Object): Unit = { + def fun_oo(x: AnyRef, y: AnyRef): Unit = { (x: Any) == y; (x ) == y; (x: Any) != y; diff --git a/test/files/pos/bug20.scala b/test/files/pos/bug20.scala index bdf33ef20d..4f1e5b1732 100644 --- a/test/files/pos/bug20.scala +++ b/test/files/pos/bug20.scala @@ -1,8 +1,8 @@ object Exceptions { - class CubeException(s: String) extends java.lang.RuntimeException(s); + class CubeException(s: String) extends RuntimeException(s); def main(args: Array[String]) = - System.out.println(new CubeException("test")); + Console.println(new CubeException("test")); } diff --git a/test/files/pos/bug211.scala b/test/files/pos/bug211.scala index 895fb9a8f1..424a396ea1 100644 --- a/test/files/pos/bug211.scala +++ b/test/files/pos/bug211.scala @@ -3,6 +3,6 @@ trait B; class Foo requires (A with B) extends A with B; object Test extends Application { new Foo(); - System.out.println("bug211 completed"); + Console.println("bug211 completed"); } diff --git a/test/files/pos/bug267.scala b/test/files/pos/bug267.scala index 619ba82e94..66add083f7 100644 --- a/test/files/pos/bug267.scala +++ b/test/files/pos/bug267.scala @@ -20,7 +20,7 @@ trait Base { object testBase extends Application with Base { type exp = Exp; val term = new Num(2); - System.out.println(term.eval); + Console.println(term.eval); } /** Data extension: An extension of `Base' with `Plus' expressions diff --git a/test/files/pos/bug31.scala b/test/files/pos/bug31.scala index 92f33bfd02..aa787ca794 100644 --- a/test/files/pos/bug31.scala +++ b/test/files/pos/bug31.scala @@ -23,7 +23,7 @@ object Main { def main(args: Array[String]) = { val s = List(1, 2); - System.out.println(arb(s)) + Console.println(arb(s)) } } diff --git a/test/files/pos/bug32.scala b/test/files/pos/bug32.scala index 4354727d1a..7f901a9ac1 100644 --- a/test/files/pos/bug32.scala +++ b/test/files/pos/bug32.scala @@ -6,9 +6,9 @@ class PromptStream(s: OutputStream) extends PrintStream(s) { object Main { - val out = new PromptStream(System.out); + val out = new PromptStream(java.lang.System.out); - System.setOut(out); + java.lang.System.setOut(out); def main(args: Array[String]) = //out.println("hello world"); diff --git a/test/files/pos/bug360.scala b/test/files/pos/bug360.scala index 9c5f243365..0860eb8ee3 100644 --- a/test/files/pos/bug360.scala +++ b/test/files/pos/bug360.scala @@ -5,7 +5,7 @@ abstract class Bug360A requires Bug360C { } trait Bug360B requires Bug360C { object d { - System.out.println(f); + Console.println(f); } } abstract class Bug360C extends Bug360A with Bug360B; diff --git a/test/files/pos/bug374.scala b/test/files/pos/bug374.scala index 9a452cbb79..31a98871a8 100644 --- a/test/files/pos/bug374.scala +++ b/test/files/pos/bug374.scala @@ -5,7 +5,7 @@ object tokens extends Enumeration { val NAME = Value("name"); } -object test extends Object with Application { +object test extends AnyRef with Application { import tokens._; val reserved = new scala.collection.mutable.HashMap[String, Token](); diff --git a/test/files/pos/bug49.scala b/test/files/pos/bug49.scala index 913ce06e00..dd86642263 100644 --- a/test/files/pos/bug49.scala +++ b/test/files/pos/bug49.scala @@ -1,3 +1,3 @@ -class C1(x: Object) {}; +class C1(x: AnyRef) {}; -class C2 extends C1({ class A extends Object {}; (new A) : Object }) {}; +class C2 extends C1({ class A extends AnyRef {}; (new A) : AnyRef }) {}; diff --git a/test/files/pos/bug516.scala b/test/files/pos/bug516.scala index 38aa4f70a6..67e1799f28 100644 --- a/test/files/pos/bug516.scala +++ b/test/files/pos/bug516.scala @@ -5,8 +5,8 @@ class Members; object subscriber extends Subscriber[Message[String] with Undoable, Members] { def notify(pub: Members, event: Message[String] with Undoable): Unit = (event: Message[String]) match { - case Include(elem) => System.err.println("ADD: " + elem); - case Remove(elem) => System.err.println("REM: " + elem); + case Include(elem) => Console.println("ADD: " + elem); + case Remove(elem) => Console.println("REM: " + elem); //case i : Include[HasTree] with Undoable => //case r : Remove [HasTree] with Undoable => } diff --git a/test/files/pos/constfold.scala b/test/files/pos/constfold.scala index 2eb31b4086..0082b8cd5f 100644 --- a/test/files/pos/constfold.scala +++ b/test/files/pos/constfold.scala @@ -7,8 +7,8 @@ object A { object Test extends Application { - System.out.println(A.x); - System.out.println(A.y); - System.out.println(A.z); - System.out.println(A.s); + Console.println(A.x); + Console.println(A.y); + Console.println(A.z); + Console.println(A.s); } diff --git a/test/files/pos/exceptions.scala b/test/files/pos/exceptions.scala index 819368244d..f71d215a23 100644 --- a/test/files/pos/exceptions.scala +++ b/test/files/pos/exceptions.scala @@ -7,14 +7,14 @@ object Test { def main(args: Array[String]): Unit = { try { try { - System.out.println("hi!"); + Console.println("hi!"); error("xx"); } finally { - System.out.println("ho!") + Console.println("ho!") } } catch { - case ex: IOException => System.out.println("io exception!"); - case ex => System.out.println(ex); + case ex: IOException => Console.println("io exception!"); + case ex => Console.println(ex); } } } diff --git a/test/files/pos/functions.scala b/test/files/pos/functions.scala index 3a7ce16f37..697589fd5d 100644 --- a/test/files/pos/functions.scala +++ b/test/files/pos/functions.scala @@ -6,7 +6,7 @@ object Test { val x = 1; Process.receive { case "abc" if x == 2 => - System.out.println("hi!") + Console.println("hi!") } } } diff --git a/test/files/pos/gui.scala b/test/files/pos/gui.scala index b40759fb01..54ecbfa719 100644 --- a/test/files/pos/gui.scala +++ b/test/files/pos/gui.scala @@ -21,9 +21,9 @@ trait Screen { object DummyScreen extends Screen { def drawRect(r: Geom.Rectangle, c: Color): unit = - System.out.println("draw " + r + " with " + c); + Console.println("draw " + r + " with " + c); def fillRect(r: Geom.Rectangle, c: Color): unit = - System.out.println("fill " + r + " with " + c); + Console.println("fill " + r + " with " + c); } object GUI { @@ -35,7 +35,7 @@ object GUI { trait Glyph { def getRect: Geom.Rectangle; def setLoc(p: Geom.Point): unit; - def draw() = System.out.println("draw " + this); + def draw() = Console.println("draw " + this); } class Label(scr: Screen, p: Geom.Point, name: String) extends Glyph { @@ -71,7 +71,7 @@ object GUI { def enable(b: boolean): this.type = { enabled = b; draw(); this } def getGlyph = label; final def mouseDown(p: Geom.Point): unit = - if (enabled) doit() else System.out.println("button is disabled"); + if (enabled) doit() else Console.println("button is disabled"); /* deferred method to be specified by client */ def doit(): unit; @@ -81,7 +81,7 @@ object GUI { object GUIClient { class Application { - def quit() = System.out.println("application exited"); + def quit() = Console.println("application exited"); } class QuitButton (scr: Screen, p: Geom.Point, name: String, a: Application) diff --git a/test/files/pos/localmodules.scala b/test/files/pos/localmodules.scala index 8ed34f455a..3e1600842c 100644 --- a/test/files/pos/localmodules.scala +++ b/test/files/pos/localmodules.scala @@ -7,7 +7,7 @@ object main { object b { trait c {} - def foo(x: c): c = { System.out.println("foo(" + x + ")"); x } + def foo(x: c): c = { Console.println("foo(" + x + ")"); x } } @@ -17,6 +17,6 @@ object main { def main(args: Array[String]) = { val aa = new a; val xx: aa.b.c = null; - System.out.println(aa.bar(xx)); + Console.println(aa.bar(xx)); } } diff --git a/test/files/pos/matthias4.scala b/test/files/pos/matthias4.scala index c6ce79d682..18599ae714 100644 --- a/test/files/pos/matthias4.scala +++ b/test/files/pos/matthias4.scala @@ -20,7 +20,7 @@ object C requires B { } */ -trait _a extends Object with _b { +trait _a extends AnyRef with _b { val a: _a; val A: A; type A <: a.AObject; @@ -29,7 +29,7 @@ trait _a extends Object with _b { def setX(x: B.X): Unit; } } -trait a123 extends Object with _a with _b { +trait a123 extends AnyRef with _a with _b { val a: this.type = this; val A: A = new A(); class A() extends AObject { @@ -48,7 +48,7 @@ trait _b { def setX(x: X): Unit; } } -abstract class b() extends Object with _b { +abstract class b() extends AnyRef with _b { val b: this.type = this; val B: B = new B(); class B() extends BObject { @@ -64,7 +64,7 @@ trait _m { type M <: m.MObject; trait MObject {} } -abstract class m() extends Object with _m with _b { +abstract class m() extends AnyRef with _m with _b { val m: this.type = this; val M: M = new M(); class M() extends MObject with a123 with Linker { diff --git a/test/files/pos/michel2.scala b/test/files/pos/michel2.scala index e6976b0f40..914c1b27ab 100644 --- a/test/files/pos/michel2.scala +++ b/test/files/pos/michel2.scala @@ -1,15 +1,15 @@ object Test { - trait A extends Object { + trait A extends AnyRef { def f : Int = 1 } - class B extends Object with A { + class B extends AnyRef with A { override def f : Int = super[A].f } def main(args: Array[String]) = - System.out.println(new B().f); + Console.println(new B().f); } diff --git a/test/files/pos/michel5.scala b/test/files/pos/michel5.scala index 345ae04d9d..34832c00ca 100644 --- a/test/files/pos/michel5.scala +++ b/test/files/pos/michel5.scala @@ -1,5 +1,5 @@ trait A[Ta] { } -class B() extends Object with A[Int] { +class B() extends AnyRef with A[Int] { val x : Int = 2 -} \ No newline at end of file +} diff --git a/test/files/pos/override.scala b/test/files/pos/override.scala index 9f068b8ecd..6312564f4d 100644 --- a/test/files/pos/override.scala +++ b/test/files/pos/override.scala @@ -1,13 +1,13 @@ -trait A extends Object { +trait A extends AnyRef { def f = 1; val x: A; } -trait B extends Object { +trait B extends AnyRef { def f = 2; } -trait C extends Object with A with B { +trait C extends AnyRef with A with B { override def f = super[B].f; val a: A; val x: a.type = a; diff --git a/test/files/pos/rebind.scala b/test/files/pos/rebind.scala index 3b7b27ac34..61ff0c223e 100644 --- a/test/files/pos/rebind.scala +++ b/test/files/pos/rebind.scala @@ -9,5 +9,5 @@ trait Bar { def foo: Inner = foo; } class Test extends Foo with Bar { - System.out.println(foo.inner); + Console.println(foo.inner); } diff --git a/test/files/pos/seqtest2.scala b/test/files/pos/seqtest2.scala index 903b270c95..239b1b5816 100644 --- a/test/files/pos/seqtest2.scala +++ b/test/files/pos/seqtest2.scala @@ -3,7 +3,7 @@ object test { val b = List(1, 2, 3); def main(args: Array[String]) = - System.out.println( + Console.println( b match { case List(1, 2, 3) => true; case _ => false; diff --git a/test/files/pos/testcast.scala b/test/files/pos/testcast.scala index 631b2c922b..2a78b5f2a2 100644 --- a/test/files/pos/testcast.scala +++ b/test/files/pos/testcast.scala @@ -22,5 +22,5 @@ object Test { val b: B = null; - System.out.println(b.bar); + Console.println(b.bar); } diff --git a/test/files/pos/thistype.scala b/test/files/pos/thistype.scala index 8c0ba209be..c8f7ec9678 100644 --- a/test/files/pos/thistype.scala +++ b/test/files/pos/thistype.scala @@ -1,11 +1,11 @@ object Test { class Ctl { - def enable: this.type = { System.out.println("enable"); this } + def enable: this.type = { Console.println("enable"); this } } class MouseCtl extends Ctl { - def mouseDown(x: int, y: int): unit = { System.out.println("mouse down"); } + def mouseDown(x: int, y: int): unit = { Console.println("mouse down"); } } def main(args: Array[String]) = diff --git a/test/files/pos/traits.scala b/test/files/pos/traits.scala index d2c3f7c71b..1418757442 100644 --- a/test/files/pos/traits.scala +++ b/test/files/pos/traits.scala @@ -35,8 +35,6 @@ object Test { val thickness = 2; val color = 0; } - System.out.println(bcs1 == bcs1); - System.out.println(bcs1 == bcs2) + Console.println(bcs1 == bcs1); + Console.println(bcs1 == bcs2) } - - diff --git a/test/files/pos/viewtest1.scala b/test/files/pos/viewtest1.scala index 4019690961..da56afcc8b 100644 --- a/test/files/pos/viewtest1.scala +++ b/test/files/pos/viewtest1.scala @@ -37,6 +37,6 @@ object Test { for (val s <- args) { t = t insert s } - System.out.println(t.elements) + Console.println(t.elements) } } diff --git a/test/files/pos/viewtest2.scala b/test/files/pos/viewtest2.scala index 6a6ed96df7..c7c0408ef2 100644 --- a/test/files/pos/viewtest2.scala +++ b/test/files/pos/viewtest2.scala @@ -95,21 +95,21 @@ object Test { for (val s <- args) { t = t insert s } - System.out.println(t.elements) + Console.println(t.elements) } { var t: Tree[Str] = Empty for (val s <- args) { t = t insert Str(s) } - System.out.println(t.elements) + Console.println(t.elements) } { var t: Tree[List[char]] = Empty for (val s <- args) { t = t insert toCharList(s) } - System.out.println(t.elements) + Console.println(t.elements) } } } 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; diff --git a/test/files/script/fact.scala b/test/files/script/fact.scala index 76d52b6910..d48dac6f0f 100644 --- a/test/files/script/fact.scala +++ b/test/files/script/fact.scala @@ -21,7 +21,7 @@ exec scala -nocompdaemon "$SOURCE" "$@" !# -val x = Integer.parseInt(argv(0)) +val x = argv(0).toInt def fact(x: Int):Int = if(x==0) 1 -- cgit v1.2.3