diff --git a/tests/run/i16785.check b/tests/run/i16785.check new file mode 100644 index 000000000000..917d993cb822 --- /dev/null +++ b/tests/run/i16785.check @@ -0,0 +1 @@ +specific: 1 diff --git a/tests/run/i16785.scala b/tests/run/i16785.scala new file mode 100644 index 000000000000..a2217c99f6a4 --- /dev/null +++ b/tests/run/i16785.scala @@ -0,0 +1,14 @@ +object Test { + 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] + } + + def main(args: Array[String]): Unit = + println(test(IntBox(1))) +}