scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Inconsistent match type case legality

Open Bersier opened this issue 2 weeks ago • 1 comments

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.

Bersier avatar Nov 26 '25 13:11 Bersier