From 262ee3a852f278f97b083a05376de0eab96c805d Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 11 Dec 2010 14:57:06 +0000 Subject: When was the last time -Xcheckinit was run? It ... When was the last time -Xcheckinit was run? It must have been a long time. All these changes are to address bugs revealed by -Xcheckinit, mostly in test cases, some in the compiler. I'm guessing the partest -Xcheckinit runs are hanging the first time they run into a failure, so if it starts "working" again after this commit don't get too confident. No review. --- test/files/run/bug428.check | 8 -------- test/files/run/bug428.scala | 37 ------------------------------------- test/files/run/bug429.check | 2 +- test/files/run/bug429.scala | 4 ++-- test/files/run/existentials.scala | 16 ++++++++-------- test/files/run/spec-init.check | 4 ++-- test/files/run/spec-init.scala | 3 +-- test/files/run/t1524.scala | 2 +- test/files/run/t3897/J_2.java | 8 ++++++-- test/files/run/t3897/a_2.scala | 14 ++++++++++++-- 10 files changed, 33 insertions(+), 65 deletions(-) delete mode 100644 test/files/run/bug428.check delete mode 100644 test/files/run/bug428.scala (limited to 'test/files/run') diff --git a/test/files/run/bug428.check b/test/files/run/bug428.check deleted file mode 100644 index 21bef2f8d3..0000000000 --- a/test/files/run/bug428.check +++ /dev/null @@ -1,8 +0,0 @@ -Foo 1: a = 0, b = 0, x = 0, y = 0 -Foo 2: a = 2, b = 0, x = 0, y = 0 -Foo 3: a = 2, b = 3, x = 0, y = 0 -Foo 4: a = 2, b = 3, x = 0, y = 0 -Foo 5: a = 2, b = 3, x = 0, y = 0 -Bar 1: a = 2, b = 3, x = 0, y = 0 -Bar 2: a = 2, b = 3, x = 5, y = 0 -Bar 3: a = 2, b = 3, x = 5, y = 7 diff --git a/test/files/run/bug428.scala b/test/files/run/bug428.scala deleted file mode 100644 index 34d99efd1f..0000000000 --- a/test/files/run/bug428.scala +++ /dev/null @@ -1,37 +0,0 @@ -object Test { - - abstract class Foo(_a: Int, _b: Int) { - - Console.println("Foo 1: " + this); - val a: Int = _a; - Console.println("Foo 2: " + this); - val b: Int = { fun(); _b } - Console.println("Foo 3: " + this); - val x: Int; - Console.println("Foo 4: " + this); - val y: Int; - Console.println("Foo 5: " + this); - - - def fun(): Unit = (); - - override def toString(): String = - "a = " + a + ", b = " + b + ", x = " + x + ", y = " + y; - - } - - class Bar(_a: Int, _b: Int, _x: Int, _y: Int) extends Foo(_a, _b) { - - Console.println("Bar 1: " + this); - val x: Int = _x; - Console.println("Bar 2: " + this); - val y: Int = { fun(); _y } - Console.println("Bar 3: " + this); - - } - - def main (args: Array[String]): Unit = { - new Bar(2,3,5,7); - } - -} diff --git a/test/files/run/bug429.check b/test/files/run/bug429.check index 9e871b7bff..22b91b7850 100644 --- a/test/files/run/bug429.check +++ b/test/files/run/bug429.check @@ -1 +1 @@ -AyB1 +AyB5 diff --git a/test/files/run/bug429.scala b/test/files/run/bug429.scala index b2cc8128c0..e62a6b307b 100644 --- a/test/files/run/bug429.scala +++ b/test/files/run/bug429.scala @@ -6,8 +6,8 @@ object Test { } class B extends A { Console.print("B"); - val z = 0; - val x = 4 + z + lazy val z = 0; + lazy val x = 4 + z } def main (args: Array[String]): Unit = { Console.print((new B).y); diff --git a/test/files/run/existentials.scala b/test/files/run/existentials.scala index 471f8fe779..902ae31b5a 100644 --- a/test/files/run/existentials.scala +++ b/test/files/run/existentials.scala @@ -69,14 +69,6 @@ object Test extends Application { case _ => } - var ex: Counter[T] forSome { type T } = _ - ex = ci - ex = cf - - var exW: Counter[_] = _ - ex = ci - ex = cf - val ci = new Counter[Int] { def newCounter = 0 def get(i: Int) = i @@ -91,6 +83,14 @@ object Test extends Application { def name = "Float" } + var ex: Counter[T] forSome { type T } = _ + ex = ci + ex = cf + + var exW: Counter[_] = _ + ex = ci + ex = cf + foo(ci) foo(cf) fooW(ci) diff --git a/test/files/run/spec-init.check b/test/files/run/spec-init.check index 8a659f868c..7705ee2947 100644 --- a/test/files/run/spec-init.check +++ b/test/files/run/spec-init.check @@ -1,9 +1,9 @@ abc abc -null +abc shouldn't see two initialized values and one uninitialized 42 42 -0 +42 ok ok diff --git a/test/files/run/spec-init.scala b/test/files/run/spec-init.scala index bd3428f4ea..60852245b4 100644 --- a/test/files/run/spec-init.scala +++ b/test/files/run/spec-init.scala @@ -5,11 +5,10 @@ class Foo[@specialized(Int) T](_x: T) { val y = x println(x) println(y) - println(z) def baz {} val z = y - + println(z) } class Bar[@specialized(Int) T] { diff --git a/test/files/run/t1524.scala b/test/files/run/t1524.scala index 4f6c65d052..3b06afdbfd 100644 --- a/test/files/run/t1524.scala +++ b/test/files/run/t1524.scala @@ -1,6 +1,6 @@ object Test extends Application { - val buf = new scala.collection.mutable.ArrayBuffer[String] { override val initialSize = 0 } + val buf = new scala.collection.mutable.ArrayBuffer[String](0) buf += "initial" buf += "second" println(buf.head) diff --git a/test/files/run/t3897/J_2.java b/test/files/run/t3897/J_2.java index 5d5131737e..a4c9a98fb1 100644 --- a/test/files/run/t3897/J_2.java +++ b/test/files/run/t3897/J_2.java @@ -4,13 +4,17 @@ public class J_2 { public void f1(Class clazz) { Field[] fields = clazz.getDeclaredFields(); for (int i = 0 ; i < fields.length; i++) { - System.out.println("(" + fields[i].getName() + "," + fields[i].getGenericType() + ")"); + String name = fields[i].getName(); + if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { } + else System.out.println("(" + name + "," + fields[i].getGenericType() + ")"); } } public void f2(Class clazz) { Method[] methods = clazz.getDeclaredMethods(); for (int i = 0 ; i < methods.length; i++) { - System.out.println("(" + methods[i].getName() + "," + methods[i].getGenericReturnType() + ")"); + String name = methods[i].getName(); + if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { } + else System.out.println("(" + name + "," + methods[i].getGenericReturnType() + ")"); } } diff --git a/test/files/run/t3897/a_2.scala b/test/files/run/t3897/a_2.scala index da5f8df63e..7a161fcbe4 100644 --- a/test/files/run/t3897/a_2.scala +++ b/test/files/run/t3897/a_2.scala @@ -1,6 +1,16 @@ object Test { - def f1(clazz: Class[_]) = clazz.getDeclaredFields.toList map (f => (f.getName, f.getGenericType)) foreach println - def f2(clazz: Class[_]) = clazz.getDeclaredMethods.toList map (f => (f.getName, f.getGenericReturnType)) foreach println + def f1(clazz: Class[_]) = ( + clazz.getDeclaredFields.toList + . filterNot (_.getName contains "bitmap$") + . map (f => (f.getName, f.getGenericType)) + . foreach (println) + ) + def f2(clazz: Class[_]) = ( + clazz.getDeclaredMethods.toList + . filterNot (_.getName contains "bitmap$") + . map (f => (f.getName, f.getGenericReturnType)) + . foreach (println) + ) def main(args: Array[String]): Unit = { f1(classOf[One]) -- cgit v1.2.3