Created
July 22, 2014 13:21
-
-
Save szeiger/4200fa1d5795a03f2e0a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
trait Foo[X] | |
object Foo extends EImplicits | |
trait Bar[X] | |
object Bar extends EImplicits | |
trait E[X] | |
trait EImplicits extends EImplicitsLowPrio { | |
implicit final def fooEvidence[T : E]: E[Foo[T]] = null | |
} | |
trait EImplicitsLowPrio { | |
implicit final def barEvidence[T : E]: E[Bar[T]] = null | |
} | |
object ETest { | |
implicit val intEvidence: E[Int] = null | |
implicitly[E[Foo[Bar[Int]]]] | |
} | |
/* | |
$ scalac SelfAmbiguous.scala | |
SelfAmbiguous.scala:20: error: ambiguous implicit values: | |
both method fooEvidence in trait EImplicits of type [T](implicit evidence$1: E[T])E[Foo[T]] | |
and method fooEvidence in trait EImplicits of type [T](implicit evidence$1: E[T])E[Foo[T]] | |
match expected type E[Foo[Bar[Int]]] | |
implicitly[E[Foo[Bar[Int]]]] | |
^ | |
one error found | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment