Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
> scala -Xlog-implicits
Welcome to Scala 2.12.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_172).
Type in expressions for evaluation. Or try :help.
scala> object A {
| import scala.language.implicitConversions
| implicit val int: Int = 1
| def a[A]: A = ???
| implicit def asString[A](implicit i: Int): Long => A = _ => a[A]
|
| val s: String = 1L
| }
<console>:17: asString is not a valid implicit value for Long(1L) => String because:
type mismatch;
found : Long(1L)
required: Int
val s: String = 1L
^
<console>:17: error: type mismatch;
found : Long(1L)
required: String
val s: String = 1L
^
scala> object B {
| import scala.language.implicitConversions
| implicit val int: Int = 1
| def a[A]: A = ???
| implicit def asString[A](l: Long)(implicit i: Int): A = a[A]
|
| val s: String = 1L
| }
defined object B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.