Open sir-wabbit opened 3 weeks ago
Even funnier:
trait Foo[+L] {
def test[F[_ >: L] >: Unit]: Unit
}
this complains that a covariant type occurs in ... contravariant position.
Firstly F[_ >: L] >: LF
is our syntax for F >: [_ >: L] =>> LF
. When we check the lower bound we flip to contravariance. But when we try to figure out what the variance of that L is, we accidentally bias to being in a covariant position, when we're actually in contravariant position. So seems like it should be an easy fix (waiting for CI).
Compiler version
3.5.0
Minimized code
Output
Expectation
Should compile. Does compile in Scala 2.
This works for example and I am not sure that the outer lower bound should change anything.
This also doesn't work
But this does: