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/pos/t6157.scala | |
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/pos/t6157.scala')
-rw-r--r-- | test/files/pos/t6157.scala | 25 |
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 + } + } +} + |