summaryrefslogtreecommitdiff
path: root/test/files/pos/t0586.scala
blob: 86115a77af2399df21e53adae9435c0ddc7e01b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
object RClose {
  type ReflectCloseable = { def close(): Unit }
  def withReflectCloseable[T <: ReflectCloseable, R](s: T)(action: T => R): R =
    try {
      action(s)
    } finally {
      s.close()
    }
}