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
traitFunctor[F[_]]:extension [A](fa: F[A])
defvoid:F[Unit] =???givenFunctor[Option] with {}
given [F[_], X]:Functor[[T] =>>F[X]] with {}
defmain=valo:Option[Int] =???
o.void
Output
[error] ./main.scala:13:3:Found: (o : Option[Int])
[error] Required:?{ void: ? }
[error] Note that implicit extension methods cannot be applied because they are ambiguous;
[error] both objectgiven_Functor_Option and giveninstance given_Functor_F provide an extension method `void` on (o : Option[Int])
[error] o.void
[error] ^
Expectation
Should possibly resolve the method from given_Functor_Option.
Interestingly, the following code compiles correctly and resolves the method from given_Functor_Option. (moving the extension method outside of the type class declaration and adding an implicit constraint instead)
traitFunctor[F[_]]
extension [F[_]:Functor, A](fa: F[A])
defvoid:F[Unit] =???givenFunctor[Option] with {}
given [F[_], X]:Functor[[T] =>>F[X]] with {}
defmain=valo:Option[Int] =???
o.void
Ooooh, right. Those two examples aren't really equivalent.
The method from given_Functor_Option was resolved up until 3.0.2, but I guess that was a bug then.
Compiler version
3.1.1
, ... ,3.1.3
,3.2.0-RC1
,3.2.1-RC1-bin-20220711-6efd92d-NIGHTLY
Minimized code
Output
Expectation
Should possibly resolve the method from
given_Functor_Option
.Interestingly, the following code compiles correctly and resolves the method from
given_Functor_Option
. (moving the extension method outside of the type class declaration and adding an implicit constraint instead)Found in #15647
The text was updated successfully, but these errors were encountered: