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/pos | |
parent | 8b0cd5cf7c2a682dd70d6b8ea32b521015bf2269 (diff) | |
download | scala-257a1845d3db3477a0b5939e94d77b0495d89561.tar.gz scala-257a1845d3db3477a0b5939e94d77b0495d89561.tar.bz2 scala-257a1845d3db3477a0b5939e94d77b0495d89561.zip |
Refactored portability support
Diffstat (limited to 'test/files/pos')
33 files changed, 65 insertions, 73 deletions
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) } } } |