diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/virtpatmat_unapplyprod.check | 4 | ||||
-rw-r--r-- | test/files/run/virtpatmat_unapplyprod.flags | 1 | ||||
-rw-r--r-- | test/files/run/virtpatmat_unapplyprod.scala | 23 |
3 files changed, 28 insertions, 0 deletions
diff --git a/test/files/run/virtpatmat_unapplyprod.check b/test/files/run/virtpatmat_unapplyprod.check new file mode 100644 index 0000000000..2660ff8f96 --- /dev/null +++ b/test/files/run/virtpatmat_unapplyprod.check @@ -0,0 +1,4 @@ +(2,3) +(2,3) +(2,3) +List(true, false, true) diff --git a/test/files/run/virtpatmat_unapplyprod.flags b/test/files/run/virtpatmat_unapplyprod.flags new file mode 100644 index 0000000000..9769db9257 --- /dev/null +++ b/test/files/run/virtpatmat_unapplyprod.flags @@ -0,0 +1 @@ + -Yvirtpatmat -Xexperimental diff --git a/test/files/run/virtpatmat_unapplyprod.scala b/test/files/run/virtpatmat_unapplyprod.scala new file mode 100644 index 0000000000..441e5e3968 --- /dev/null +++ b/test/files/run/virtpatmat_unapplyprod.scala @@ -0,0 +1,23 @@ +object Test extends App { + case class Foo(x: Int, y: String) + + Foo(2, "3") match { + case Foo(x, y) => println((x, y)) + } + + case class FooSeq(x: Int, y: String, z: Boolean*) + + FooSeq(2, "3") match { + case FooSeq(x, y) => println((x, y)) + } + + FooSeq(2, "3", true, false, true) match { + case FooSeq(x, y) => println("nope") + case FooSeq(x, y, true, false, true) => println((x, y)) + } + + FooSeq(1, "a", true, false, true) match { + case FooSeq(1, "a") => println("nope") + case FooSeq(1, "a", x@_* ) => println(x.toList) + } +}
\ No newline at end of file |