Skip to content

Illegal match type case inconsistently reported #20433

Open
@Bersier

Description

@Bersier

Compiler version

3.5.0-RC1

Minimized code

type At[V, L <: TList[R[V]], K <: Long] <: Option[?] = L match
  case Empty.type => None.type // When this line is commented out, the code does not compile
  case Cons[R[V], (k, v), tail] => None.type

trait TList[+T]
object Empty extends TList[Nothing]
class Cons[+E, +H <: E, +T <: TList[E]] extends TList[E]

type R[+T] = (Long, T)

Output

Compiles fine

Expectation

Compiler error, similarly to what happens for

type At[V, L <: TList[R[V]], K <: Long] <: Option[?] = L match
  // case Empty.type => None.type
  case Cons[R[V], (k, v), tail] => None.type

trait TList[+T]
object Empty extends TList[Nothing]
class Cons[+E, +H <: E, +T <: TList[E]] extends TList[E]

type R[+T] = (Long, T)

Error message:

The match type contains an illegal case

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions