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

Structural GADT crashes the compiler #1

Open
Linyxus opened this issue Oct 26, 2021 · 0 comments
Open

Structural GADT crashes the compiler #1

Linyxus opened this issue Oct 26, 2021 · 0 comments

Comments

@Linyxus
Copy link
Owner

Linyxus commented Oct 26, 2021

Minimized code

trait Expr { type T }
trait IntLit extends Expr { type T <: Int }
trait IntExpr extends Expr { type T = Int }

def foo[A](e: Expr { type T = A }) = e match {
  case _: IntLit =>
    val a: A = 0 // error
    val i: Int = ??? : A

  case _: Expr { type T <: Int } =>
    val a: A = 0 // error
    val i: Int = ??? : A // limitation // error

  case _: IntExpr =>
    val a: A = 0
    val i: Int = ??? : A

  case _: Expr { type T = Int } =>
    val a: A = 0
    val i: Int = ??? : A
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant