aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/customArgs/i1240.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-05-01 09:25:11 +0200
committerMartin Odersky <odersky@gmail.com>2016-05-18 19:43:21 +0200
commit2dd6a7ae07cca7b03372d6b9f1fb30e0fcc975b7 (patch)
tree72c8c976258d4cc1f96c75f034bbfe9e4a717a19 /tests/neg/customArgs/i1240.scala
parentd0f05ad6c756355bb6ea863e10a554f54f145907 (diff)
downloaddotty-2dd6a7ae07cca7b03372d6b9f1fb30e0fcc975b7.tar.gz
dotty-2dd6a7ae07cca7b03372d6b9f1fb30e0fcc975b7.tar.bz2
dotty-2dd6a7ae07cca7b03372d6b9f1fb30e0fcc975b7.zip
Test case
Diffstat (limited to 'tests/neg/customArgs/i1240.scala')
-rw-r--r--tests/neg/customArgs/i1240.scala40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/neg/customArgs/i1240.scala b/tests/neg/customArgs/i1240.scala
new file mode 100644
index 000000000..6235e8815
--- /dev/null
+++ b/tests/neg/customArgs/i1240.scala
@@ -0,0 +1,40 @@
+package test
+
+class C[T] {
+
+ def foo(x: D) = { System.out.println("D foo"); }
+ def foo(x: T) = { System.out.println("T foo"); }
+}
+
+object C {
+ def main(args: Array[String]) =
+ new C[D]().foo(new D()) // error: ambiguous
+}
+/*
+class C1[T] {
+ def foo(x: D) = { System.out.println("D foo"); }
+}
+class C2[T] {
+ def foo(x: D) = { System.out.println("D foo"); }
+}
+
+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 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?
+}
+*/