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
No implicit argument of type F[T] was found (works in Scala 2) #15210
Comments
it compiles if you make trait Observer[-T]
trait PublishSubject[-A] extends Observer[A]
trait Source[H[_]]
implicit object source extends Source[PublishSubject]
def foo[F[_]: Source, T2 <: String](source: F[T2]) = ()
def foo[F[_]: Source, T2 <: Option[String]](source: F[T2], dummy: Unit = ()) = ()
val x:PublishSubject[Option[String]] = new PublishSubject[Option[String]] {}
foo(x) |
Yes, I noticed that too. It was quite difficult to find this reproducing piece of code. |
It also fails with |
Minimized from https://contributors.scala-lang.org/t/better-type-inference-for-scala-send-us-your-problematic-cases/2410/173, here's another case where overloading and implicit search seem to break in Scala 3 compared to Scala 2: class BodyReadable[R]
trait CustomResponse {
def body: String
def body[T: BodyReadable]: T
}
class MustExpectable[T] {
def must: Any = ???
}
trait MustExpectations {
import scala.language.implicitConversions
implicit def theValue[T](t: T): MustExpectable[T] = ???
}
object Test extends MustExpectations {
val r: CustomResponse = ???
r.body.must // error
val rbody = r.body
rbody.must // OK
} This affects play where it is worked around using a lot of imports: playframework/playframework@8d48699 |
Compiler version
3.1.3-RC2
Minimized code
https://scastie.scala-lang.org/7HyQgDhzSgmRUO0mJPgPwA
Output
Expectation
Should compile like in Scala
2.13
The text was updated successfully, but these errors were encountered: