Skip to content

Instantly share code, notes, and snippets.

@clhodapp
Last active January 25, 2016 07:49
Show Gist options
  • Save clhodapp/5b85993c524670896705 to your computer and use it in GitHub Desktop.
Save clhodapp/5b85993c524670896705 to your computer and use it in GitHub Desktop.
Welcome to Scala 2.12.0-M3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions for evaluation. Or try :help.
scala> :paste
// Entering paste mode (ctrl-D to finish)
trait Foo[A]
object Foo {
@annotation.implicitAmbiguous("Custom ambiguous message")
implicit val a = new Foo[String] { }
implicit val b = new Foo[String] { }
implicit val c = new Foo[String] { }
}
// Exiting paste mode, now interpreting.
defined trait Foo
defined object Foo
scala> implicitly[Foo[String]]
<console>:14: error: ambiguous implicit values:
both value a in object Foo of type => Foo[String]
and value b in object Foo of type => Foo[String]
match expected type Foo[String]
implicitly[Foo[String]]
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment