Closed
Description
dotty compiles following code:
object O {
sealed trait Box[T] { def value: T }
final case class IntBox(value: Int) extends Box[Int]
implicit def s1[T](implicit box: Box[T]): String = "generic: " + box.value
implicit def s2(implicit box: Box[Int]): String = "specific: " + box.value
def test[T](implicit box: Box[T]): String = box match {
case IntBox(_) => implicitly[String]
}
}
The implicit resolved in test
is s1
(the generic one). scalac
refuses to compile the code, saying that the implicit is ambiguous.