summaryrefslogtreecommitdiff
path: root/test/files/pos/t6157.scala
blob: 7463989b14c1d2244b2b4bf7a50410471569c821 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
    }
  }
}