From 820897b978ee6837ca463b186bab0f6349807c18 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 22 May 2012 00:34:06 +0200 Subject: SI-2405 Confer implicit privileges to renamed imports. Yin and yang would be pleased: A fix in two parts. 1. Use the name of the imported symbol, rather than the alias, in the generated `Select(qual, name)` tree. 2. Do the opposite in `isQualifyingImplicit`, which performs one part of the shadowing check. But there is still work to do. The second part of the shadowing check, `nonImplicitSynonymInScope`, fails to notice this case (irrespective of aliased imports). // Expecting shadowing #2. Alas, none is cast! object Test1 { object A { implicit val x: Int = 1 } import A.x def x: Int = 0 implicitly[Int] } I'm hitching the residual problem to SI-4270's wagon. --- test/files/neg/t2405.check | 8 ++++++++ test/files/neg/t2405.scala | 10 ++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/files/neg/t2405.check create mode 100644 test/files/neg/t2405.scala (limited to 'test/files/neg') diff --git a/test/files/neg/t2405.check b/test/files/neg/t2405.check new file mode 100644 index 0000000000..78360bcc21 --- /dev/null +++ b/test/files/neg/t2405.check @@ -0,0 +1,8 @@ +t2405.scala:6: warning: imported `y' is permanently hidden by definition of method y + import A.{x => y} + ^ +t2405.scala:8: error: could not find implicit value for parameter e: Int + implicitly[Int] + ^ +one warning found +one error found diff --git a/test/files/neg/t2405.scala b/test/files/neg/t2405.scala new file mode 100644 index 0000000000..6982285b98 --- /dev/null +++ b/test/files/neg/t2405.scala @@ -0,0 +1,10 @@ +object A { implicit val x: Int = 1 } + +// Expecting shadowing #1 +object Test2 { + { + import A.{x => y} + def y: Int = 0 + implicitly[Int] + } +} -- cgit v1.2.3