summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-05-22 15:22:39 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-05-22 15:22:39 -0700
commitb801c8432dd5520f1564d3acd902baa47c6e2bd8 (patch)
treec04928ec88589e98bfb98f6e065b8cb8b3b9932d /test/files
parentc842ef3097a0ef5acb98fa85140f24f367885468 (diff)
parent820897b978ee6837ca463b186bab0f6349807c18 (diff)
downloadscala-b801c8432dd5520f1564d3acd902baa47c6e2bd8.tar.gz
scala-b801c8432dd5520f1564d3acd902baa47c6e2bd8.tar.bz2
scala-b801c8432dd5520f1564d3acd902baa47c6e2bd8.zip
Merge pull request #598 from retronym/ticket/2405
SI-2405 Confer implicit privileges to renamed imports.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/t2405.check8
-rw-r--r--test/files/neg/t2405.scala10
-rw-r--r--test/files/pos/t2405.scala23
3 files changed, 41 insertions, 0 deletions
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]
+ }
+}
diff --git a/test/files/pos/t2405.scala b/test/files/pos/t2405.scala
new file mode 100644
index 0000000000..224b2ce83b
--- /dev/null
+++ b/test/files/pos/t2405.scala
@@ -0,0 +1,23 @@
+object A { implicit val x: Int = 1 }
+
+// Problem as stated in the ticket.
+object Test1 {
+ import A.{x => y}
+ implicitly[Int]
+}
+
+// Testing for the absense of shadowing #1.
+object Test2 {
+ import A.{x => y}
+ val x = 2
+ implicitly[Int]
+}
+
+// Testing for the absense of shadowing #2.
+object Test3 {
+ {
+ import A.{x => y}
+ def x: Int = 0
+ implicitly[Int]
+ }
+}