Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
case class Instantiator[T]()
def instantiate[T](implicit inst: Instantiator[T]): T = null.asInstanceOf[T]
val x: String = instantiate
// error: could not find implicit for Instantiator[T]
implicit def inst1: Instantiator[String] = Instantiator[String]
implicit def inst2: Instantiator[Int] = Instantiator[Int]
val x: String = instantiate
// error: ambiguous implicits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment