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

Match type on type alias with multiple parameters fails #22644

Open
kavedaa opened this issue Feb 23, 2025 · 0 comments
Open

Match type on type alias with multiple parameters fails #22644

kavedaa opened this issue Feb 23, 2025 · 0 comments

Comments

@kavedaa
Copy link

kavedaa commented Feb 23, 2025

Compiler version

3.6.3, Scala 3.7.0-RC1-bin-20250222-4dc4668-NIGHTLY

Minimized code

package bug

object ExhibitA:

  trait Foo:
    type A
    type B

  type F[X, Y] = Foo { type A = X; type B = Y }

  //  fails
  type M[T] = T match
    case F[a, b] => (a, b)

  trait Bar extends Foo { type A = Int; type B = String }

  summon[M[Bar] =:= (Int, String)]


object ExhibitB:

  trait Foo:
    type A
    
  type F[X] = Foo { type A = X }

  //  works
  type M[T] = T match
    case F[a] => a

  trait Bar extends Foo { type A = Int }

  summon[M[Bar] =:= Int]

Output

[error] .\bug.scala:14:15
[error] The match type contains an illegal case:
[error]     case bug.ExhibitA.F[a, b] => (a, b)
[error] The pattern contains a type alias `F`.
[error] (this error can be ignored for now with `-source:3.3`)

Expectation

Successful compilation

@kavedaa kavedaa added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 23, 2025
@Gedochao Gedochao added area:match-types and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 24, 2025
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