Closed
Description
Minimized code
object Incompat2 {
trait Context { type Out }
object Context {
def foo(implicit ctx: Context): Option[ctx.Out] = ???
def bar(implicit ctx: Context): (Option[ctx.Out], String) = (foo, "foo")
}
}
Output
7 | def bar(implicit ctx: Context): (Option[ctx.Out], String) = (foo, "foo")
| ^^^^^^^^^^^^
| Found: (Option[Any], String)
| Required: (Option[ctx.Out], String)
Expectation
The code compiles.
It does compile if we pass the implicit parameter explicitly, though:
object Incompat2 {
trait Context { type Out }
object Context {
def foo(implicit ctx: Context): Option[ctx.Out] = ???
def bar(implicit ctx: Context): (Option[ctx.Out], String) = (foo(ctx), "foo") // note: foo(ctx)
}
}
Probably a similar test case can be found in https://github.com/mlachkar/scala-migrat3/pull/22