Skip to content

Instantly share code, notes, and snippets.

@nrinaudo
Created July 1, 2017 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrinaudo/c579d03667ff8527b74e7e6322551117 to your computer and use it in GitHub Desktop.
Save nrinaudo/c579d03667ff8527b74e7e6322551117 to your computer and use it in GitHub Desktop.
Shows how implicit name conflicts even if types don't
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