From 17037367049312eb3d26766a5759295ac9f8aed6 Mon Sep 17 00:00:00 2001 From: Miguel Garcia Date: Mon, 6 Aug 2012 18:31:35 +0200 Subject: SI-6157 don't inline callee with exception-handler(s) if potentially unsafe --- test/files/pos/t6157.flags | 1 + test/files/pos/t6157.scala | 25 +++++++++++++++++++++++++ test/files/run/private-inline.scala | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 test/files/pos/t6157.flags create mode 100644 test/files/pos/t6157.scala (limited to 'test/files') 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 -- cgit v1.2.3