From 942bf86c7bb28c7d9aeae82204ae060ae330d9b6 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 8 Nov 2010 18:13:08 +0000 Subject: This is work on -Ycheck:icode. distribution can now be built with that option, with or without optimization, and almost all tests cases can. (Those which can't are due to different -Ycheck: issues.) Major changes of interest are as follows: * LOAD_EXCEPTION and THROW are parameterized on the throwable symbol. * Does not squash all traits down to AnyRef, but instead deals with issues as they arise. By observation the cases where one needs a "Foo with Product" to manifest as both a "Foo" and a "Product" at different places are quite rare, so we need not throw out the whole baby. * Exception handlers now have positions. * The remaining checker failures removed, such as CALL_METHOD wanting to pop a value off the stack after calling a constructor. * Many multiply defined values such as REFERENCE(ObjectClass) put in one place (ICodes.scala) and reused. * -Ycheck:icode output (if also given -Ydebug) worthy of Michelangelo. Here is a class and the -Ycheck:icode -Ydebug output for f's block. class A { def f(x: Int, y: String) = try println(x + y.length) catch { case x: NullPointerException => () } } ** Checking Block 4 [S: 3, 2] [P: 1] 1-> REF(singleton class Predef) 3 + LOAD_MODULE object Predef 2-> INT 3 + LOAD_LOCAL(value x) 3-> REF(class String) 3 + LOAD_LOCAL(value y) 2<- REF(class String) 3 - CALL_METHOD java.lang.String.length (dynamic) 3-> INT 3 + CALL_METHOD java.lang.String.length (dynamic) 2<- INT 3 - CALL_PRIMITIVE(Arithmetic(ADD,INT)) 1<- INT 3 - """ 2-> INT 3 + CALL_PRIMITIVE(Arithmetic(ADD,INT)) 1<- INT 3 - BOX INT 2-> REF(class Integer) 3 + BOX INT 1<- REF(class Integer) 3 - CALL_METHOD scala.Predef.println (dynamic) 0<- REF(singleton class Predef) 3 - CALL_METHOD scala.Predef.println (dynamic) Review by dragos (I marked the specific spots I thought of interest with "PP to ID" which makes it sound like I'm talking to my primal self. Next week on programmer theater: "PP to SUPEREGO.") --- test/files/pos/simple-exceptions.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/files/pos') diff --git a/test/files/pos/simple-exceptions.scala b/test/files/pos/simple-exceptions.scala index 52c33fb43a..38f2fc8500 100644 --- a/test/files/pos/simple-exceptions.scala +++ b/test/files/pos/simple-exceptions.scala @@ -7,14 +7,14 @@ object Test { def main(args: Array[String]): Unit = { try { try { - Console.println("hi!"); - error("xx"); - } finally { - Console.println("ho!") + Console.println("hi!") + error("xx") } - } catch { + finally Console.println("ho!") + } + catch { case ex: IOException => Console.println("io exception!"); - case ex => Console.println(ex); + case ex => Console.println(ex); } } } -- cgit v1.2.3