-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
scala/scala
#9171Description
reproduction steps
using Scala 2.13\ 2.12 with the following code
import scala.annotation.unchecked.uncheckedVariance
trait TypeClass[F[_]] {
def action[A](foo: F[A], bar: F[A]): F[A]
}
class Syntax[F[+_], A](private val foo: F[A]) extends AnyVal {
def action[F1[+x] >: F[x] @uncheckedVariance](
bar: F1[A]
)(implicit tc: TypeClass[F1]): F1[A] =
tc.action[A](foo, bar)
}problem
compilation produces error
[error] scala.reflect.internal.Types$TypeError: type mismatch;
[error] found : F1(in method action$extension)[A1(in method action$extension),B1(in method action$extension)]
[error] required: (some other)A1(in method action$extension) (some other)F1(in method action$extension) (some other)B1(in method action$extension)
Any of the following actions:
- remove
@uncheckedVariance - remove
extends AnyVal
make the error disappear