blob: ea6d3bcb78c601c27779e88078d0ead9c0ff6d84 (
plain) (
blame)
1
2
3
4
5
6
7
|
object Test {
import scala.ref.WeakReference
def unapply[T <: AnyVal](wr: WeakReference[T]): Option[T] = {
val x = wr.underlying.get
if (x != null) Some(x) else None // error
}
}
|