-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Compiler version
all I tested Scala 3:
3.3.7, 3.4.3, 3.5.2, 3.6.4, 3.7.3
works in Scala 2.13.17
Minimized code
//> using scala 3.7.3
trait X
sealed trait Y
case object YY extends Y, X
case object ZZ extends Y, X
def foo[A <: X & Y](x: A): Unit =
x match {
case YY => ()
}
foo(ZZ)https://scastie.scala-lang.org/road21/DXVR0WnlSTO0pXmoKgKVpQ/1
Output
Exception in thread "main" scala.MatchError: ZZ (of class model$_$ZZ$)Expectation
[warn] It would fail on the following input: ZZ
[warn] x match {
[warn] ^It works in Scala 2:
//> using scala 2
trait X
sealed trait Y
case object YY extends Y with X
case object ZZ extends Y with X
def foo[A <: X with Y](x: A): Unit =
x match {
case YY => ()
}
foo(ZZ)