Closed
Description
Compiler version
3.3.1
Minimized code
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
Output
this case is unreachable since type String is not a subclass of trait Seq
val A(a, rest*) = 1
Expectation
It should compile and A(a, rest*)
should be a sequence-match.
The specification states that sequence-matches have higher priority than product-sequence-matches, but this seems not to be correctly implemented
Note that the code compiles as expected if any of the _X
fields is removed