aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-14 09:45:44 +0100
committerMartin Odersky <odersky@gmail.com>2017-04-04 13:29:38 +0200
commit4bdad3c21a1461bed6e91ef69dd767fa5211f60d (patch)
tree79cc5cd66c51519e399f2617d1f5f553fd321e25 /tests
parentc58555e434d886e079104b0311ecb523f4ee1b40 (diff)
downloaddotty-4bdad3c21a1461bed6e91ef69dd767fa5211f60d.tar.gz
dotty-4bdad3c21a1461bed6e91ef69dd767fa5211f60d.tar.bz2
dotty-4bdad3c21a1461bed6e91ef69dd767fa5211f60d.zip
Change return type of `apply`.
In an enum case like case C() extends P1 with ... with Pn ... apply now returns `P1 & ... & Pn`, where before it was just P1. Also, add to Option test.
Diffstat (limited to 'tests')
-rw-r--r--tests/run/enum-Option.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/run/enum-Option.scala b/tests/run/enum-Option.scala
index 74e449daf..b9efadf0d 100644
--- a/tests/run/enum-Option.scala
+++ b/tests/run/enum-Option.scala
@@ -2,6 +2,7 @@ enum class Option[+T] extends Serializable {
def isDefined: Boolean
}
object Option {
+ def apply[T](x: T): Option[T] = if (x == null) None else Some(x)
case Some(x: T) {
def isDefined = true
}
@@ -11,6 +12,8 @@ object Option {
}
object Test {
- def main(args: Array[String]) =
+ def main(args: Array[String]) = {
assert(Some(None).isDefined)
+ Option(22) match { case Option.Some(x) => assert(x == 22) }
+ }
}