Skip to content

Commit

Permalink
add neg test
Browse files Browse the repository at this point in the history
  • Loading branch information
liufengyun authored and allanrenucci committed Sep 9, 2018
1 parent 48b7dbb commit 6999ca8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/neg/i4984.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
object Array2 {
def unapplySeq(x: Array[Int]): Data = new Data

final class Data {
def isEmpty: Boolean = false
def get: Data = this
def lengthCompare(len: Int): Int = 0
def apply(i: Int): Int = 3
def drop(n: Int): scala.Seq[String] = Seq("hello")
def toSeq: scala.Seq[Int] = Seq(6, 7)
}
}

object Test {
def test1(xs: Array[Int]): Int = xs match {
case Array2(x, y) => x + y // error // error
}

def test2(xs: Array[Int]): Seq[Int] = xs match {
case Array2(x, y, xs:_*) => xs // error
}

def test3(xs: Array[Int]): Seq[Int] = xs match {
case Array2(xs:_*) => xs // error
}
}

0 comments on commit 6999ca8

Please sign in to comment.