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
Then, the call to zip is incorrect. Thanks to the receiver, now of type Ctx#Tree, the first type argument should be A >: Ctx#Tree. But c.Tree <: Ctx#Tree, not the other way around.
But I can make the compiler crash with a bit of help from specialization:
$ cat test-spec.scala
traitCtx {
traitTree
}
traitLst[+A] {
defzip[A1>:A, B](that: Lst[B]):Nothing
}
classC[@specialized(Int) T] {
defmoo(t: T) = {
deffoo(c: Ctx)(l: Lst[c.Tree]) = l zip l
???
}
}
$ scalac test-spec.scala
test-spec.scala:9:error: typearguments [c.Tree,c.Tree] do not conform to method zip'stypeparameter bounds [A1>:Ctx#Tree,B]
deffoo(c: Ctx)(l: Lst[c.Tree]) = l zip l
^
one error found
If you look closely, the translation is incorrect:
instead of
zip
is incorrect. Thanks to the receiver, now of type Ctx#Tree, the first type argument should be A >: Ctx#Tree. But c.Tree <: Ctx#Tree, not the other way around.The tree checkers don't seem to mind:
But I can make the compiler crash with a bit of help from specialization:
By the way, this is another one caught by the miniboxing plugin:
miniboxing/miniboxing-plugin#218
The text was updated successfully, but these errors were encountered: