summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-09-11 05:21:13 -0700
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-09-11 05:21:13 -0700
commit228fb309a18d080dbcb2e51c1bbdf74da60865f9 (patch)
tree7ff9848c4d67769e0c9f7478ba7520ef4841d6a0 /test
parent4f696fe22f273aa0c3fa6d86c788904ae88fab3b (diff)
parent6f78b501c226bd3c24c516801a23865531591ebe (diff)
downloadscala-228fb309a18d080dbcb2e51c1bbdf74da60865f9.tar.gz
scala-228fb309a18d080dbcb2e51c1bbdf74da60865f9.tar.bz2
scala-228fb309a18d080dbcb2e51c1bbdf74da60865f9.zip
Merge pull request #1274 from retronym/ticket/6335
SI-6335 More precise location of the implicit class synthetic method.
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t6335.check9
-rw-r--r--test/files/neg/t6335.scala7
-rw-r--r--test/files/pos/t6335.scala25
3 files changed, 41 insertions, 0 deletions
diff --git a/test/files/neg/t6335.check b/test/files/neg/t6335.check
new file mode 100644
index 0000000000..1727a05eb2
--- /dev/null
+++ b/test/files/neg/t6335.check
@@ -0,0 +1,9 @@
+t6335.scala:6: error: method Z is defined twice
+ conflicting symbols both originated in file 't6335.scala'
+ implicit class Z[A](val i: A) { def zz = i }
+ ^
+t6335.scala:3: error: method X is defined twice
+ conflicting symbols both originated in file 't6335.scala'
+ implicit class X(val x: Int) { def xx = x }
+ ^
+two errors found
diff --git a/test/files/neg/t6335.scala b/test/files/neg/t6335.scala
new file mode 100644
index 0000000000..5c41e81ef5
--- /dev/null
+++ b/test/files/neg/t6335.scala
@@ -0,0 +1,7 @@
+object ImplicitClass {
+ def X(i: Int) {}
+ implicit class X(val x: Int) { def xx = x }
+
+ def Z[A](i: A) {}
+ implicit class Z[A](val i: A) { def zz = i }
+} \ No newline at end of file
diff --git a/test/files/pos/t6335.scala b/test/files/pos/t6335.scala
new file mode 100644
index 0000000000..50e34092d1
--- /dev/null
+++ b/test/files/pos/t6335.scala
@@ -0,0 +1,25 @@
+object E extends Z {
+ def X = 3
+ implicit class X(val i: Int) {
+ def xx = i
+ }
+
+ def Y(a: Any) = 0
+ object Y
+ implicit class Y(val i: String) { def yy = i }
+
+ implicit class Z(val i: Boolean) { def zz = i }
+}
+
+trait Z {
+ def Z = 0
+}
+
+object Test {
+ import E._
+ 0.xx
+
+ "".yy
+
+ true.zz
+}