summaryrefslogtreecommitdiff
path: root/test/files/neg/t3453.scala
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-05-26 14:14:12 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-05-26 14:14:12 +0000
commite239d7fa5b9de5edffb06022c4cc5a9c105a51d3 (patch)
tree5aac86ae523db164174e39c900a5d2c5ad094075 /test/files/neg/t3453.scala
parentc932ec58f9e6fc90c9497bb4cbfb09f2b398e7ea (diff)
downloadscala-e239d7fa5b9de5edffb06022c4cc5a9c105a51d3.tar.gz
scala-e239d7fa5b9de5edffb06022c4cc5a9c105a51d3.tar.bz2
scala-e239d7fa5b9de5edffb06022c4cc5a9c105a51d3.zip
svnmerge + tags
Diffstat (limited to 'test/files/neg/t3453.scala')
-rw-r--r--test/files/neg/t3453.scala66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/files/neg/t3453.scala b/test/files/neg/t3453.scala
new file mode 100644
index 0000000000..090b777151
--- /dev/null
+++ b/test/files/neg/t3453.scala
@@ -0,0 +1,66 @@
+// test shadowing of implicits by synonymous non-implicit symbols
+// whether they be inherited, imported (explicitly or using a wildcard) or defined directly
+class A
+class B
+
+trait S {
+ implicit def aToB(a: A): B = new B
+}
+
+class T1 extends S {
+ def x: B = {
+ val aToB = 3
+ // ok: doesn't compile, because aToB method requires 'T.this.' prefix
+ //aToB(new A)
+
+ // bug: compiles, using T.this.aToB,
+ // despite it not being accessible without a prefix
+ new A
+ }
+}
+
+object O {
+ implicit def aToB(a: A): B = new B
+}
+
+class T2a {
+ import O._
+
+ def x: B = {
+ val aToB = 3
+ // ok: doesn't compile, because aToB method requires 'T.this.' prefix
+ //aToB(new A)
+
+ // bug: compiles, using T.this.aToB,
+ // despite it not being accessible without a prefix
+ new A
+ }
+}
+
+class T2b {
+ import O.aToB
+
+ def x: B = {
+ val aToB = 3
+ // ok: doesn't compile, because aToB method requires 'T.this.' prefix
+ //aToB(new A)
+
+ // bug: compiles, using T.this.aToB,
+ // despite it not being accessible without a prefix
+ new A
+ }
+}
+
+class T3 {
+ implicit def aToB(a: A): B = new B
+
+ def x: B = {
+ val aToB = 3
+ // ok: doesn't compile, because aToB method requires 'T.this.' prefix
+ //aToB(new A)
+
+ // bug: compiles, using T.this.aToB,
+ // despite it not being accessible without a prefix
+ new A
+ }
+} \ No newline at end of file