From 9129cfe9117e41d44cda30222ffef22b70767cfb Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Mon, 4 Jun 2012 19:59:51 +0200 Subject: SI-4270 Disqualify in scope implicits that are shadowed. If an expression wouldn't type check explicitly, it shouldn't be allowed implicitly. Employs typedIdent, which already does this sort of thing rather well, instead of continuing to reimplement it in Implicits. Remove check for non-implicit synonym, which is subsumed by typing an Ident. Workaround Scaladoc oddity, by using an attributed select when the context is deficient. --- test/files/neg/t5376.scala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/files/neg/t5376.scala (limited to 'test/files/neg/t5376.scala') diff --git a/test/files/neg/t5376.scala b/test/files/neg/t5376.scala new file mode 100644 index 0000000000..8da3868566 --- /dev/null +++ b/test/files/neg/t5376.scala @@ -0,0 +1,24 @@ +object Test { + object O1 { implicit def f(s: String): Int = 1 } + object O2 { implicit def f(s: String): Int = 2 } + object O3 { def f(s: String): Int = 3 } + + // Import two implicits with the same name in the same scope. + def m1 = { + import O1._ + import O2._ + + // Implicit usage compiles. + "a": Int + } + + // Import one implict and one non-implicit method with the + // same name in the same scope. + def m2 = { + import O1._ + import O3._ + + // Implicit usage compiles. + "a": Int + } +} \ No newline at end of file -- cgit v1.2.3