summaryrefslogtreecommitdiff
path: root/test/files/pos/t0586.scala
blob: 540e225a14651debd69efacab78ac1182b9b7a80 (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()
    }
}