-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prioritise sequence-matches over product-sequence-matches #19260
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this test be a run test, in order to exercise this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do. At some point I was curious as to what the code would do if I made it compile without the TypeTestCasts compile error, and it indeed threw. But this part of the code I just left as potentially useful debugging if returned to. But we can also make it actually part of the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not actually part of testing #19221 per se, then it can be left as is.