You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
objectApp {
caseclassBox[F[_]](value: F[Int])
sealedtraitIsK[F[_], G[_]]
finalcaseclassReflK[F[_]]() extendsIsK[F, F]
deffoo[F[_], G[_]](r: FIsKG, a: Box[F]):Box[G] = r match { caseReflK() => a }
defmain(args: Array[String]):Unit= {
println(foo(ReflK(), Box(Option(10))))
}
}
-- [E007] TypeMismatchError: foo.scala:6:81----------------------------------6|deffoo[F[_], G[_]](r: FIsKG, a: Box[F]):Box[G] = r match { caseReflK() => a }
|^|found: App.Box[F](a)
|required: App.Box[G]
||where: F is a typein method foo with bounds <:G[_]
|G is a typein method foo with bounds <:F[_]
one error found
The text was updated successfully, but these errors were encountered:
sir-wabbit
changed the title
GADT pattern matching produces conformance constraints instead of equality
GADT pattern matching produces conformance constraints instead of equality (HKTs)
Sep 2, 2018
In Dotty type equality is just type conformance twice: A = B means A <: B and B <: A. But then constraint solving should unify variables if A <: B and B <: A.
We end up with GADT constraints foo >:> S and S >:> foo but we don't have a mechanism to unify GADT constraints, so we end up with a loop in subtyping checks.
except that even with that bug, we should have F <: G or F <: [X] => G[X], and F <: G[_] looks wrong or misleading.
The text was updated successfully, but these errors were encountered: