diff options
author | liu fengyun <liu@fengy.me> | 2017-04-13 15:03:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-13 15:03:13 +0200 |
commit | fb4adc3c9c55476d2fe0deed22cff54e8e945406 (patch) | |
tree | b7577f66688ed793a73ff543042a140e62cbe80d /tests/run/1938-2.scala | |
parent | cf37737f56db7bc2f7429f78328dc5eea1716356 (diff) | |
parent | de6461ab17562dbb46a1ff094590e051d03cb54c (diff) | |
download | dotty-fb4adc3c9c55476d2fe0deed22cff54e8e945406.tar.gz dotty-fb4adc3c9c55476d2fe0deed22cff54e8e945406.tar.bz2 dotty-fb4adc3c9c55476d2fe0deed22cff54e8e945406.zip |
Merge branch 'master' into fix-2253
Diffstat (limited to 'tests/run/1938-2.scala')
-rw-r--r-- | tests/run/1938-2.scala | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/run/1938-2.scala b/tests/run/1938-2.scala new file mode 100644 index 000000000..32e4c4518 --- /dev/null +++ b/tests/run/1938-2.scala @@ -0,0 +1,37 @@ +object ProdNonEmpty { + def _1: Int = 0 + def _2: String = "???" // Slight variation with scalac: this test passes + // with ??? here. I think dotty behavior is fine + // according to the spec given that methods involved + // in pattern matching should be pure. + def isEmpty = false + def unapply(s: String): this.type = this + def get = this +} + +object ProdEmpty { + def _1: Int = ??? + def _2: String = ??? + def isEmpty = true + def unapply(s: String): this.type = this + def get = this +} + +object Test { + def main(args: Array[String]): Unit = { + "" match { + case ProdNonEmpty(0, _) => () + case _ => ??? + } + + "" match { + case ProdNonEmpty(1, _) => ??? + case _ => () + } + + "" match { + case ProdEmpty(_, _) => ??? + case _ => () + } + } +} |