From 7e1a139a3545280101fb122e16028c60a9cfee01 Mon Sep 17 00:00:00 2001 From: michelou Date: Fri, 18 Jan 2008 20:50:06 +0000 Subject: removed more warnings --- test/files/run/bugs.scala | 81 ++++++++++++++++---------------- test/files/run/map_test.scala | 64 ++++++++++++------------- test/files/run/tcpoly_parseridioms.scala | 4 +- 3 files changed, 73 insertions(+), 76 deletions(-) (limited to 'test/files/run') diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index ae23dc6b91..9339c1867f 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -7,9 +7,9 @@ // Bug 98 object Bug98Test { - object MyCase { def name = "mycase" }; - def test(args: Array[String]) = { - Console.println(MyCase.name); + object MyCase { def name = "mycase" } + def test(args: Array[String]) { + println(MyCase.name) } } @@ -17,23 +17,24 @@ object Bug98Test { // Bug 120 class Bug120A(x: Int) { - Console.println("A"); + println("A") } trait Bug120B { - Console.println("B"); + println("B") } class Bug120C(x: Int) extends Bug120A(Bug120Test.print("one", 1)) with Bug120B { - Console.println("C"); + println("C") } object Bug120Test { def print[A](str: String, res: A): A = { - Console.println(str); res + println(str); res } - def test(args: Array[String]) = { - val c = new Bug120C(1); + def test(args: Array[String]) { + val c = new Bug120C(1) + () } } @@ -42,12 +43,12 @@ object Bug120Test { object Bug135Test { - import scala.collection.immutable.TreeMap; + import scala.collection.immutable.TreeMap - def test(args: Array[String]): Unit = { - val myMap:TreeMap[int,String] = new TreeMap; - val map1 = myMap + 42 -> "The answer"; - Console.println(map1.get(42)); + def test(args: Array[String]) { + val myMap:TreeMap[Int, String] = new TreeMap + val map1 = myMap + Pair(42, "The answer") + println(map1.get(42)) } } @@ -65,17 +66,17 @@ trait Bug142Bar2 { type Inner; def foo: Inner; foo; } trait Bug142Bar3 { class Inner; def foo: Inner = {Console.println("ok"); null}; } trait Bug142Bar4 { class Inner; def foo: Inner; foo; } -object Bug142Test1 extends Bug142Foo1 with Bug142Bar1 {def test(args:Array[String]):Unit=();} -object Bug142Test2 extends Bug142Foo2 with Bug142Bar2 {def test(args:Array[String]):Unit=();} -object Bug142Test3 extends Bug142Foo3 with Bug142Bar3 {def test(args:Array[String]):Unit=();} -object Bug142Test4 extends Bug142Foo4 with Bug142Bar4 {def test(args:Array[String]):Unit=();} -object Bug142Test5 extends Bug142Foo1 with Bug142Bar1 {def test(args:Array[String]):Unit=();} -object Bug142Test6 extends Bug142Foo2 with Bug142Bar2 {def test(args:Array[String]):Unit=();} -object Bug142Test7 extends Bug142Foo3 with Bug142Bar3 {def test(args:Array[String]):Unit=();} -object Bug142Test8 extends Bug142Foo4 with Bug142Bar4 {def test(args:Array[String]):Unit=();} +object Bug142Test1 extends Bug142Foo1 with Bug142Bar1 { def test(args: Array[String]) {} } +object Bug142Test2 extends Bug142Foo2 with Bug142Bar2 { def test(args: Array[String]) {} } +object Bug142Test3 extends Bug142Foo3 with Bug142Bar3 { def test(args: Array[String]) {} } +object Bug142Test4 extends Bug142Foo4 with Bug142Bar4 { def test(args: Array[String]) {} } +object Bug142Test5 extends Bug142Foo1 with Bug142Bar1 { def test(args: Array[String]) {} } +object Bug142Test6 extends Bug142Foo2 with Bug142Bar2 { def test(args: Array[String]) {} } +object Bug142Test7 extends Bug142Foo3 with Bug142Bar3 { def test(args: Array[String]) {} } +object Bug142Test8 extends Bug142Foo4 with Bug142Bar4 { def test(args: Array[String]) {} } object Bug142Test { - def test(args:Array[String]): Unit = { + def test(args:Array[String]) { Bug142Test1; Bug142Test2; Bug142Test3; @@ -92,10 +93,10 @@ object Bug142Test { // Bug 166 object Bug166Test { - import scala.collection.mutable.HashMap ; - def test(args:Array[String]) = { - val m:HashMap[String,String] = new HashMap[String,String]; - m.update("foo","bar"); + import scala.collection.mutable.HashMap + def test(args: Array[String]) { + val m: HashMap[String,String] = new HashMap[String, String] + m.update("foo","bar") } } @@ -110,8 +111,8 @@ class Bug167Node(bar:Int) { } object Bug167Test { - def test(args: Array[String]): Unit = { - if (new Bug167Node(0).foo != 1) Console.println("bug 167"); + def test(args: Array[String]) { + if (new Bug167Node(0).foo != 1) println("bug 167"); } } @@ -119,13 +120,13 @@ object Bug167Test { // Bug 168 class Bug168Foo { - class Bar; - def foo = new Bar; + class Bar + def foo = new Bar } object Bug168Test { - def test(args: Array[String]): Unit = { - (new Bug168Foo).foo; + def test(args: Array[String]) { + (new Bug168Foo).foo () } } @@ -135,25 +136,25 @@ object Bug168Test { class Bug174Foo[X] { - class Tree; - class Node extends Tree; + class Tree + class Node extends Tree - val inner:Inner = new SubInner; + val inner: Inner = new SubInner trait Inner { - def test: Bug174Foo[X]#Tree ; + def test: Bug174Foo[X]#Tree } class SubInner extends Inner { - def test = new Node; + def test = new Node } } object Bug174Test { - def test(args: Array[String]): Unit = { - (new Bug174Foo[Int]).inner.test; + def test(args: Array[String]) { + (new Bug174Foo[Int]).inner.test () } } diff --git a/test/files/run/map_test.scala b/test/files/run/map_test.scala index 53ee416367..4358878a81 100644 --- a/test/files/run/map_test.scala +++ b/test/files/run/map_test.scala @@ -1,42 +1,38 @@ -import scala.collection.immutable.Map; -import scala.collection.immutable.TreeMap; -import scala.collection.immutable.ListMap; +import scala.collection.immutable.{ListMap, Map, TreeMap} object Test extends Application { - test1(); - test2(); - Console.println("OK"); + test1() + test2() + println("OK") + def test1() { + val myMap: TreeMap[Int, String] = new TreeMap + test_map(myMap) + } + def test2() { + val myMap: ListMap[Int, String] = new ListMap + test_map(myMap) + } - def test1() = { - val myMap:TreeMap[int,String] = new TreeMap; - test_map(myMap); + def test_map(myMap: Map[Int, String]) { + val map1 = myMap.update(42,"The answer") + val map2 = map1.update(17,"A small random number") + val map3 = map2.update(666,"A bigger random number") + val map4 = map3.update(4711,"A big random number") + map1 == myMap + Pair(42, "The answer") + var i = 0 + var map = map4 + while(i < 43) { + map = map.update(i,i.toString()) + i += 1 } - - def test2() = { - val myMap:ListMap[int,String] = new ListMap; - test_map(myMap); - } - - def test_map(myMap:Map[int,String]) = { - val map1 = myMap.update(42,"The answer"); - val map2 = map1.update(17,"A small random number"); - val map3 = map2.update(666,"A bigger random number"); - val map4 = map3.update(4711,"A big random number"); - map1 == myMap + 42 -> "The answer"; - var i = 0; - var map = map4; - while(i < 43) { - map = map.update(i,i.toString()); - i = i + 1; - } - i = 0; - while(i < 4712) { - if(map.isDefinedAt(i)) - Console.print(i + "->" + map(i) + " "); - i = i + 1; - } - Console.println(""); + i = 0 + while(i < 4712) { + if (map.isDefinedAt(i)) + print(i + "->" + map(i) + " "); + i += 1 } + println("") + } } diff --git a/test/files/run/tcpoly_parseridioms.scala b/test/files/run/tcpoly_parseridioms.scala index 0e2512f5bc..6d7a0be0c2 100644 --- a/test/files/run/tcpoly_parseridioms.scala +++ b/test/files/run/tcpoly_parseridioms.scala @@ -1,5 +1,5 @@ trait Parsers { - type Input=List[char] + type Input = List[Char] sealed class ParseResult[+t](val next: Input) case class Success[+t](override val next: Input, result: t) extends ParseResult[t](next) @@ -105,5 +105,5 @@ trait ParserIdioms extends Parsers with Idioms { } object Test extends ParserIdioms with Application { - Console.println(expr(List.fromString("12"))) + println(expr("12".toList)) } -- cgit v1.2.3