Skip to content

Commit 6999ca8

Browse files
liufengyunallanrenucci
authored andcommitted
add neg test
1 parent 48b7dbb commit 6999ca8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/neg/i4984.scala

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
object Array2 {
2+
def unapplySeq(x: Array[Int]): Data = new Data
3+
4+
final class Data {
5+
def isEmpty: Boolean = false
6+
def get: Data = this
7+
def lengthCompare(len: Int): Int = 0
8+
def apply(i: Int): Int = 3
9+
def drop(n: Int): scala.Seq[String] = Seq("hello")
10+
def toSeq: scala.Seq[Int] = Seq(6, 7)
11+
}
12+
}
13+
14+
object Test {
15+
def test1(xs: Array[Int]): Int = xs match {
16+
case Array2(x, y) => x + y // error // error
17+
}
18+
19+
def test2(xs: Array[Int]): Seq[Int] = xs match {
20+
case Array2(x, y, xs:_*) => xs // error
21+
}
22+
23+
def test3(xs: Array[Int]): Seq[Int] = xs match {
24+
case Array2(xs:_*) => xs // error
25+
}
26+
}

0 commit comments

Comments
 (0)