-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
backlogNo work planned on this by the core team for the time being.No work planned on this by the core team for the time being.compat:scala2itype:bug
Description
minimized code
trait TC[F[_]]
object TC {
implicit def instance1: TC[[x] =>> Int => x] = new TC[[x] =>> Int => x] {}
implicit def instance2: TC[List] = new TC[List] {}
}
case class Foo[F[_], A](value: F[A]) {
def bar(other: Foo[F, A])(implicit F: TC[F]): Foo[F, A] = other
}
val xs = List(1, 2, 3)
def foo1 = Foo(xs).bar(Foo(xs))
def foo2 = Foo(xs).bar(foo1)
def foo3 = Foo(xs).bar(Foo(xs)).bar(Foo(xs))
def foo4 = Foo(xs).bar(Foo(xs).bar(Foo[List, Int](xs)))
def foo5 = Foo(xs).bar(Foo(xs).bar(Foo(xs)))
Compilation output
-- Error: Foo.scala:17:43 ------------------------------------------------------
17 |def foo5 = Foo(xs).bar(Foo(xs).bar(Foo(xs)))
| ^
|ambiguous implicit arguments: both method instance1 in object TC and method instance2 in object TC match type TC[F] of parameter F of method bar in class Foo
1 error found
expectation
This is another attempt to minimize something I'm running into in the Cats tests. As in #7993 the Scala 2 equivalent compiles as expected.
It might be worth noting that if instance1
is TC[Option]
or even TC[[x] =>> x => Int]
, Dotty has no problem with this. I tried minimizing with my own trait Func[-A, +B]
but couldn't get it to error.
Metadata
Metadata
Assignees
Labels
backlogNo work planned on this by the core team for the time being.No work planned on this by the core team for the time being.compat:scala2itype:bug