Created
July 1, 2017 14:04
-
-
Save nrinaudo/c579d03667ff8527b74e7e6322551117 to your computer and use it in GitHub Desktop.
Shows how implicit name conflicts even if types don't
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
object a1 { | |
implicit val foo: Int = 1 | |
} | |
object a2 { | |
implicit val foo: String = "foo" | |
} | |
{ | |
import a1._, a2._ | |
implicitly[Int] | |
} | |
// cmd2.sc:2: could not find implicit value for parameter e: Int | |
// val res2_1 = implicitly[Int] | |
// ^ | |
//Compilation Failed | |
{ | |
import a1._ | |
implicitly[Int] | |
} | |
// res2_1: Int = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment