forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48b7dbb
commit 6999ca8
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |