-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Soundness issue with variance and higher kinded types #2971
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
Comments
Ouch, nice find! I think I figured it out the issue leading to the ClassCastException and will open a PR shortly. Your second example still fails to compile due to type inference having a hard time with unions in higher-kinded types, but let's take it one at a time. |
smarter
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 14, 2017
We shouldn't use `HKApply#superType` in `isRef`, because this means taking the upper bound of abstract type constructors.
smarter
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 14, 2017
We shouldn't use `HKApply#superType` in `isRef`, because this means taking the upper bound of abstract type constructors.
smarter
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 14, 2017
We shouldn't use `HKApply#superType` in `isRef`, because this means taking the upper bound of abstract type constructors.
smarter
added a commit
that referenced
this issue
Aug 16, 2017
Fix #2971: Soudness issue with variance and higher kinded types
Opened #2989 to track a problem related to your second example. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
While playing around with dotty I encountered what seems to be a issue with the typechecker. Here's a minimal example where I was able to reproduce the issue:
It seems like the type that dotty is inferring for
foo
isFoo[X]
, even though it should beFoo[X|Y]
, and because of this is allowing me to then use the result in ways I shouldn't be able to.Also, I couldn't find a way to annotate foo to get it to typecheck and work. One variation I tried was this:
But I was met with
I'd expect the required type should be
Foo[X|Y]
(or to be more preciseFoo[[T] => X[T] | Y[T]]
) , for which aFoo[Y]
should be fine right? Or is there a problem using subtyping with higher kinded types like this?Either way, the first example definitely seems like an issue of soundness.
The text was updated successfully, but these errors were encountered: