aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/run/virtpatmat_unapplyprod.scala
blob: 773c6230d61a17dfa698870f6800a43bf92dfcc3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
object Test extends dotty.runtime.LegacyApp {
  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)
  }
}