aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/pos/t6157.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untried/pos/t6157.scala')
-rw-r--r--tests/untried/pos/t6157.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/untried/pos/t6157.scala b/tests/untried/pos/t6157.scala
new file mode 100644
index 000000000..294387cc6
--- /dev/null
+++ b/tests/untried/pos/t6157.scala
@@ -0,0 +1,25 @@
+// SI-6157 - Compiler crash on inlined function and -optimize option
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ 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
+ }
+ }
+}
+