Last active
January 24, 2016 18:35
-
-
Save clhodapp/d74b050d7f046ccbe3b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 def a = new Foo[String] { } | |
implicit def b = new Foo[String] { } | |
implicit def c = new Foo[String] { } | |
} | |
trait Bar[A] | |
object Bar { | |
implicit def a = new Bar[String] { } | |
implicit def b = new Bar[String] { } | |
@annotation.implicitAmbiguous("Custom ambiguous message") | |
implicit def c = new Bar[String] { } | |
} | |
// Exiting paste mode, now interpreting. | |
defined trait Foo | |
defined object Foo | |
defined trait Bar | |
defined object Bar | |
scala> implicitly[Foo[String]] | |
<console>:14: error: Custom ambiguous message | |
implicitly[Foo[String]] | |
^ | |
scala> implicitly[Bar[String]] | |
<console>:14: error: ambiguous implicit values: | |
both method a in object Bar of type => Bar[String] | |
and method b in object Bar of type => Bar[String] | |
match expected type Bar[String] | |
implicitly[Bar[String]] | |
^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment