summaryrefslogtreecommitdiff
path: root/test/files/pos/simple-exceptions.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-11-08 18:13:08 +0000
committerPaul Phillips <paulp@improving.org>2010-11-08 18:13:08 +0000
commit942bf86c7bb28c7d9aeae82204ae060ae330d9b6 (patch)
treeb88f130c5294617439949d77858b3e4538eb223f /test/files/pos/simple-exceptions.scala
parent8009f723b905509e9dfa22d8746787ebb0cd11a2 (diff)
downloadscala-942bf86c7bb28c7d9aeae82204ae060ae330d9b6.tar.gz
scala-942bf86c7bb28c7d9aeae82204ae060ae330d9b6.tar.bz2
scala-942bf86c7bb28c7d9aeae82204ae060ae330d9b6.zip
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] <closed> 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.")
Diffstat (limited to 'test/files/pos/simple-exceptions.scala')
-rw-r--r--test/files/pos/simple-exceptions.scala12
1 files changed, 6 insertions, 6 deletions
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);
}
}
}