diff options
author | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-08-06 18:31:35 +0200 |
---|---|---|
committer | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-08-06 18:31:35 +0200 |
commit | 17037367049312eb3d26766a5759295ac9f8aed6 (patch) | |
tree | 0418da6136eb25aefd87fb6e4f685877d99ddd41 /test/files | |
parent | 61cc8ff61c81a1276a921ad5288ee3bebea1c96e (diff) | |
download | scala-17037367049312eb3d26766a5759295ac9f8aed6.tar.gz scala-17037367049312eb3d26766a5759295ac9f8aed6.tar.bz2 scala-17037367049312eb3d26766a5759295ac9f8aed6.zip |
SI-6157 don't inline callee with exception-handler(s) if potentially unsafe
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/pos/t6157.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t6157.scala | 25 | ||||
-rw-r--r-- | test/files/run/private-inline.scala | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/test/files/pos/t6157.flags b/test/files/pos/t6157.flags new file mode 100644 index 0000000000..0ebca3e7af --- /dev/null +++ b/test/files/pos/t6157.flags @@ -0,0 +1 @@ + -optimize diff --git a/test/files/pos/t6157.scala b/test/files/pos/t6157.scala new file mode 100644 index 0000000000..7463989b14 --- /dev/null +++ b/test/files/pos/t6157.scala @@ -0,0 +1,25 @@ +// SI-6157 - Compiler crash on inlined function and -optimize option + +object Test { + def main(args: Array[String]) { + Console.println( + ErrorHandler.defaultIfIOException("String")("String") + ) + } +} + +import java.io.IOException + +object ErrorHandler { + + @inline + def defaultIfIOException[T](default: => T)(closure: => T): T = { + try { + closure + } catch { + case e: IOException => + default + } + } +} + diff --git a/test/files/run/private-inline.scala b/test/files/run/private-inline.scala index a45300b026..a62007779c 100644 --- a/test/files/run/private-inline.scala +++ b/test/files/run/private-inline.scala @@ -30,7 +30,7 @@ final class A { } object Test { - def methodClasses = List("f1a", "f1b", "f2a", "f2b") map ("A$$anonfun$" + _ + "$1") + def methodClasses = List("f1a", "f2a") map ("A$$anonfun$" + _ + "$1") def main(args: Array[String]): Unit = { val a = new A |