Skip to content

Instantly share code, notes, and snippets.

@propensive
Created December 3, 2014 13:23
Show Gist options
  • Save propensive/624df1423c27bee56535 to your computer and use it in GitHub Desktop.
Save propensive/624df1423c27bee56535 to your computer and use it in GitHub Desktop.
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