-
Notifications
You must be signed in to change notification settings - Fork 1.1k
f-bounds and wildcards don't mix? #6146
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
This is blocking scala/scala#7458 |
Don't map arguments to their upper bounds before doing the bound check. There was a comment justifiying that by talking about non fully-determined arguments, but this check is done in PostTyper when all types should already be fully-determined. Given that this comment was written in 2014 I'm assuming it's no longer relevant.
Don't map arguments to their upper bounds before doing the bound check. There was a comment justifiying that by talking about non fully-determined arguments, but this check is done in PostTyper when all types should already be fully-determined. Given that this comment was written in 2014 I'm assuming it's no longer relevant.
@adriaanm @lrytz Any reason why the following wouldn't work: trait BS[T, S <: BS[T, S]]
trait IS extends BS[Int, IS]
sealed trait BSElem[T, S <: BS[T, S]]
object BSElem {
implicit val intStreamShape: BSElem[Int, IS] = ???
}
class Ops[A] {
def asJavaSeqStream[S <: BS[A, S]](implicit s: BSElem[A, S]): S = ???
} |
Sadly, no — I tried that. It breaks down when the implicit is used for
computing element types of streams with wider numeric types (byte stream
for example)
…On Fri, 22 Mar 2019 at 17:37, Guillaume Martres ***@***.***> wrote:
@adriaanm <https://github.com/adriaanm> @lrytz <https://github.com/lrytz>
Any reason why the following wouldn't work:
trait BS[T, S <: BS[T, S]]trait IS extends BS[Int, IS]
sealed trait BSElem[T, S <: BS[T, S]]
object BSElem {
implicit val intStreamShape: BSElem[Int, IS] = ???
}class Ops[A] {
def asJavaSeqStream[S <: BS[A, S]](implicit s: BSElem[A, S]): S = ???
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6146 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFjyyMYHPI9yVHGdnyqw7wYxec_hu8Sks5vZQbigaJpZM4cDo74>
.
|
Yes, I tried that as well... |
A full example would be helpful |
Here's a full example that, I think, reflects the situation. The source of the problem might be because of the use of
|
Fixed in the PR by relaxing the bound
I cannot answer if dotty is right to report an error in the original example in the issue description. |
Fix #6146: Fix bounds check involving wildcards and f-bounds
I think the following should compile (it does in 2.13), but it produces the following errors (note the
LazyRef
in the error message):The text was updated successfully, but these errors were encountered: