Skip to content

Commit 08070d3

Browse files
committed
Add test
1 parent 081cd06 commit 08070d3

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

tests/patmat/i6490.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8: Pattern Match Exhaustivity: Foo(Nil)

tests/patmat/i6490.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sealed class Foo(val value: Int)
2+
3+
object Foo {
4+
def unapplySeq(foo: Foo): Seq[Int] = List(foo.value)
5+
}
6+
7+
def foo(x: Foo): Unit =
8+
x match {
9+
case Foo(x, _: _*) => assert(x == 3)
10+
}

tests/run/i6490.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
final class Foo(val value: Int)
2+
3+
object Foo {
4+
def unapplySeq(foo: Foo): Seq[Int] = List(foo.value)
5+
}
6+
7+
object Test {
8+
def main(args: Array[String]): Unit = {
9+
(new Foo(3)) match {
10+
case Foo(x, _: _*) =>
11+
assert(x == 3)
12+
}
13+
}
14+
}

tests/run/i6490b.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
final class Foo(val value: Int)
2+
3+
object Foo {
4+
def unapplySeq(foo: Foo): (Int, Seq[Int]) = (foo.value, Nil)
5+
}
6+
7+
object Test {
8+
def main(args: Array[String]): Unit = {
9+
(new Foo(3)) match {
10+
case Foo(x, _: _*) =>
11+
assert(x == 3)
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)