aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-05-02 15:51:41 +0200
committerMartin Odersky <odersky@gmail.com>2016-05-18 19:43:22 +0200
commit48b716012bd72486dbf4a2bd3b293ef212f4addd (patch)
tree22e3deb275d86a1ddaa6821a7740170f64f639be /tests
parent968f1ab0cd706de8833112741407f94a6a0b2677 (diff)
downloaddotty-48b716012bd72486dbf4a2bd3b293ef212f4addd.tar.gz
dotty-48b716012bd72486dbf4a2bd3b293ef212f4addd.tar.bz2
dotty-48b716012bd72486dbf4a2bd3b293ef212f4addd.zip
Issue MergeError exception for double def situations
When finding two symbols in the same class that have the same signature as seen from some prefix, issue a merge error. This is simpler and more robust than the alternative of producing an overloaded denotation and dealing with it afterwards.
Diffstat (limited to 'tests')
-rw-r--r--tests/neg/customArgs/i1240.scala20
-rw-r--r--tests/neg/i1240a.scala17
2 files changed, 20 insertions, 17 deletions
diff --git a/tests/neg/customArgs/i1240.scala b/tests/neg/customArgs/i1240.scala
index 438199b4a..3f4d1e210 100644
--- a/tests/neg/customArgs/i1240.scala
+++ b/tests/neg/customArgs/i1240.scala
@@ -20,21 +20,7 @@ class C2[T] {
class D {}
-// more complicated example
-abstract class A {
- type C[X]
- def foo[B](x: C[B]): C[B] = {println("A.C"); x}
- def foo[B](x: List[B]): List[B] = {println("A.List"); x}
- def give[X]: C[X]
+class X {
+ def foo(x: D): D
+ def foo(x: D): D // error: already defined
}
-
-class B extends A {
- type C[X] = List[X]
- override def give[X] = Nil
- override def foo[B](x: C[B]): C[B] = {println("B.C"); x}
- // which method is overriden?
- // should any bridges be generated?
- val a: A = this
- a.foo(a.give[Int]) // what method should be called here in runtime?
-}
-
diff --git a/tests/neg/i1240a.scala b/tests/neg/i1240a.scala
new file mode 100644
index 000000000..dc711454e
--- /dev/null
+++ b/tests/neg/i1240a.scala
@@ -0,0 +1,17 @@
+
+// more complicated example
+abstract class A {
+ type C[X]
+ def foo[B](x: C[B]): C[B] = {println("A.C"); x}
+ def foo[B](x: List[B]): List[B] = {println("A.List"); x}
+ def give[X]: C[X]
+}
+
+class B extends A {
+ type C[X] = List[X]
+ override def give[X] = Nil
+ override def foo[B](x: C[B]): C[B] = {println("B.C"); x} // error: merge error during erasure
+ val a: A = this
+ a.foo(a.give[Int]) // what method should be called here in runtime?
+}
+