diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-04-11 12:01:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-11 12:01:17 +0200 |
commit | 4868fb29580a67c7a1560d5c1c7cc658e2634359 (patch) | |
tree | 1deed7fb92912f09b810e905e351fe4cd796cc6b /tests/run/zero-arity-case-class.scala | |
parent | 579571e05a08120133173933e7eaf2555846d1d7 (diff) | |
parent | 198b5cec531a8e0d6c121cc425e19a54b7818868 (diff) | |
download | dotty-4868fb29580a67c7a1560d5c1c7cc658e2634359.tar.gz dotty-4868fb29580a67c7a1560d5c1c7cc658e2634359.tar.bz2 dotty-4868fb29580a67c7a1560d5c1c7cc658e2634359.zip |
Merge pull request #1938 from dotty-staging/named-based-patmat
Change case class desugaring and decouple Products and name-based-pattern-matching
Diffstat (limited to 'tests/run/zero-arity-case-class.scala')
-rw-r--r-- | tests/run/zero-arity-case-class.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/run/zero-arity-case-class.scala b/tests/run/zero-arity-case-class.scala new file mode 100644 index 000000000..de0ba4fe1 --- /dev/null +++ b/tests/run/zero-arity-case-class.scala @@ -0,0 +1,26 @@ +case class Foo() + +object Test { + def main(args: Array[String]): Unit = { + assert(Foo.unapply(Foo()) == true) + + // unapply generate by scalac are `_ != null`, + // dotty returns true in all cases + assert(Foo.unapply(null) == true) + + Foo() match { + case Foo() => () + case _ => ??? + } + + Foo() match { + case _: Foo => () + case _ => ??? + } + + (Foo(): Any) match { + case Foo() => () + case _ => ??? + } + } +} |