aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/neg/i1793.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/neg/i1793.scala b/tests/neg/i1793.scala
new file mode 100644
index 000000000..ea6d3bcb7
--- /dev/null
+++ b/tests/neg/i1793.scala
@@ -0,0 +1,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
+ }
+}