Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/neg/i3542.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
object Test {
trait TC[A]

implicit def case1[F[_]](implicit t: => TC[F[Any]]): TC[String] = ???
implicit def case2[G[_]](implicit r: TC[G[Any]]): TC[Int] = ???

implicitly[TC[Int]] // error: no implicit argument of type TC[Int] found
}
7 changes: 7 additions & 0 deletions tests/pos/i3542-1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Foo[T]

object Test {
implicit def foo[T](implicit rec: => Foo[T]): Foo[T] = ???

val bla: Foo[Int] = implicitly[Foo[Int]]
}
20 changes: 20 additions & 0 deletions tests/pos/i3542-2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
trait ::[H, T]

trait Foo[A, R]

trait FooLowPrio {
implicit def caseOther[A]: Foo[A, A :: Any] = null
}
object Foo extends FooLowPrio {
implicit def caseCons[H, HR, T, TR]
(implicit // It's a bit artificial: the by name is not required in this example...
t: => Foo[T, TR],
h: => Foo[H, HR]
): Foo[H :: T, TR] = null

implicit def caseAny: Foo[Any, Any] = null
}

object Test {
val implicitFoo = implicitly[Foo[Long :: Any, Any]]
}