summaryrefslogtreecommitdiff
path: root/test/files/neg/overloaded-unapply.scala
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2012-03-12 17:20:06 +0100
committerSimon Ochsenreither <simon@ochsenreither.de>2012-03-12 20:33:12 +0100
commitfbeceb8f38f0a02bbfcc03ddbb0aea15dfa2f63a (patch)
treebb286056afd84151215c65241ad20ac09bd674c0 /test/files/neg/overloaded-unapply.scala
parentee51b6e1b1bc4bd60e6f6bbaea6eb3d4be8b3c97 (diff)
downloadscala-fbeceb8f38f0a02bbfcc03ddbb0aea15dfa2f63a.tar.gz
scala-fbeceb8f38f0a02bbfcc03ddbb0aea15dfa2f63a.tar.bz2
scala-fbeceb8f38f0a02bbfcc03ddbb0aea15dfa2f63a.zip
Removed "Todo: test" where a test exists.
- Renamed t960 to a more sensible name, because SI-960 is not related to the test and I couldn't find a ticket number. - Some minor fixes to @deprecated like switched or missing versions.
Diffstat (limited to 'test/files/neg/overloaded-unapply.scala')
-rw-r--r--test/files/neg/overloaded-unapply.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/files/neg/overloaded-unapply.scala b/test/files/neg/overloaded-unapply.scala
new file mode 100644
index 0000000000..36909626c1
--- /dev/null
+++ b/test/files/neg/overloaded-unapply.scala
@@ -0,0 +1,24 @@
+sealed abstract class List[+a]
+private case object Nil extends List[Nothing]
+private final case class Cons[+a](head: a, tail: List[a])
+extends List[a]
+
+object List {
+ def unapply[a](xs: List[a]): Option[(a, List[a])] = xs match {
+ case Nil => None
+ case Cons(x, xs) => Some(x, xs)
+ }
+
+ def unapply[a](xs: List[a]): Option[Null] = xs match {
+ case Nil => Some(null)
+ case Cons(_, _) => None
+ }
+
+ def foo[a](xs: List[a]) = xs match {
+ case List(x, xs) => 7
+ }
+
+ def bar(xs: Any) = xs match { // test error message OverloadedUnapplyError
+ case List(x, xs) => 7
+ }
+}