diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-06-04 19:59:51 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-06-10 09:38:32 +0200 |
commit | 9129cfe9117e41d44cda30222ffef22b70767cfb (patch) | |
tree | 0c1681dfd15ff66a19b895a0f36707750d4b870b /test/files/neg/t5376.scala | |
parent | 0dea3d5a05d838c9ad710cbcb14fbc6d83035851 (diff) | |
download | scala-9129cfe9117e41d44cda30222ffef22b70767cfb.tar.gz scala-9129cfe9117e41d44cda30222ffef22b70767cfb.tar.bz2 scala-9129cfe9117e41d44cda30222ffef22b70767cfb.zip |
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.
Diffstat (limited to 'test/files/neg/t5376.scala')
-rw-r--r-- | test/files/neg/t5376.scala | 24 |
1 files changed, 24 insertions, 0 deletions
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 |