aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/i1240a.scala
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/neg/i1240a.scala
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/neg/i1240a.scala')
-rw-r--r--tests/neg/i1240a.scala17
1 files changed, 17 insertions, 0 deletions
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?
+}
+