scala3
scala3 copied to clipboard
Inconsistent match type case legality
Compiler version
3.8.0-RC1
This code compiles
trait A:
type B
type Aux[T] = A { type B = T }
type ExtractB[T <: A] = T match
case Aux[b] => b
This code doesn't
trait A[U]:
type B
type Aux[U, T] = A[U] { type B = T }
type ExtractB[T <: A[?]] = T match
case Aux[_, b] => b
Compiler output
The match type contains an illegal case:
case Aux[_, b] => b
The pattern contains a type alias `Aux`.
Issue
According to the error message for the second snippet, the first one shouldn't compile either.