Created
October 22, 2014 03:33
-
-
Save paulp/66678e9b36e6883503dc 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 Show[A] | |
// These formulations all compile. | |
class A { | |
implicit def z1[A]: Show[A] = null | |
def f[A](implicit z: Show[A]): String = null | |
f | |
f[Int] | |
f[Int](implicitly) | |
f(implicitly[Show[Int]]) | |
} | |
// f(implicitly) requires that we mask out three implicit values, otherwise e.g. | |
// a.scala:23: error: ambiguous implicit values: | |
// both value StringCanBuildFrom in object Predef of type => scala.collection.generic.CanBuildFrom[String,Char,String] | |
// and method $conforms in object Predef of type [A]=> <:<[A,A] | |
// match expected type T | |
// f(implicitly) | |
// ^ | |
// one error found | |
class B { | |
val fallbackStringCanBuildFrom = null | |
val StringCanBuildFrom = null | |
val $conforms = null | |
implicit def z1[A]: Show[A] = null | |
def f[A](implicit z: Show[A]): String = null | |
f(implicitly) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment