Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal match type case inconsistently reported #20433

Open
Bersier opened this issue May 18, 2024 · 0 comments
Open

Illegal match type case inconsistently reported #20433

Bersier opened this issue May 18, 2024 · 0 comments

Comments

@Bersier
Copy link
Contributor

Bersier commented May 18, 2024

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
@Bersier Bersier added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 18, 2024
@Gedochao Gedochao added area:match-types and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants