-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prioritise sequence-matches over product-sequence-matches (#19260)
- Loading branch information
Showing
3 changed files
with
55 additions
and
3 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
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,17 @@ | ||
object Test: | ||
class Custom extends scala.Product1[String]: | ||
def length: Int = ??? | ||
def apply(i: Int): Boolean = ??? | ||
def drop(n: Int): scala.Seq[Boolean] = ??? | ||
def toSeq: scala.Seq[Boolean] = ??? | ||
|
||
def canEqual(that: Any): Boolean = ??? | ||
|
||
val _1: String = ??? | ||
val _2: String = ??? | ||
val _3: Seq[String] = ??? | ||
|
||
object A: | ||
def unapplySeq(i: Int): Custom = ??? | ||
|
||
val A(a, rest*) = 1 |
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,35 @@ | ||
class T1 | ||
|
||
class P1 | ||
final class P2 | ||
class P3 | ||
|
||
class E1 | ||
class E2 extends E1 | ||
class E3 extends E1 | ||
|
||
object VarExt: | ||
def unapplySeq(t1: T1): U1 = new U1 | ||
|
||
class U1 extends Product1[P1]: | ||
def canEqual(that: Any): Boolean = ??? | ||
|
||
val _1: P1 = new P1 | ||
val _2: P2 = new P2 | ||
val _3: Seq[P3] = Seq(new P3) | ||
|
||
def length: Int = ??? | ||
def apply(i: Int): E1 = ??? | ||
def drop(n: Int): Seq[E2] = ??? | ||
def toSeq: Seq[E3] = ??? | ||
|
||
class Test: | ||
def m1(t1: T1): Unit = t1 match | ||
case VarExt(c1, cs*) => // CCE: class P1 cannot be cast to class E1 | ||
val e1: E1 = c1 | ||
val e1s: Seq[E1] = cs | ||
|
||
object Main: | ||
def main(args: Array[String]): Unit = | ||
new Test().m1(new T1) | ||
|