summaryrefslogtreecommitdiff
path: root/test/files/pos/t6157.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos/t6157.scala')
-rw-r--r--test/files/pos/t6157.scala25
1 files changed, 25 insertions, 0 deletions
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
+ }
+ }
+}
+