aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/dotc/tests.scala3
-rw-r--r--tests/neg/customArgs/i1240.scala40
2 files changed, 42 insertions, 1 deletions
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala
index b646c72d5..97c872bb6 100644
--- a/test/dotc/tests.scala
+++ b/test/dotc/tests.scala
@@ -119,10 +119,11 @@ class tests extends CompilerTest {
@Test def neg_typedIdents() = compileDir(negDir, "typedIdents")
val negCustomArgs = negDir + "customArgs/"
- @Test def neg_typers() = compileFile(negCustomArgs, "typers")(allowDoubleBindings)
+ @Test def neg_typers = compileFile(negCustomArgs, "typers")(allowDoubleBindings)
@Test def neg_overrideClass = compileFile(negCustomArgs, "overrideClass", List("-language:Scala2"))
@Test def neg_autoTupling = compileFile(negCustomArgs, "autoTuplingTest", args = "-language:noAutoTupling" :: Nil)
@Test def neg_i1050 = compileFile(negCustomArgs, "i1050", List("-strict"))
+ @Test def neg_i1240 = compileFile(negCustomArgs, "i1240")(allowDoubleBindings)
val negTailcallDir = negDir + "tailcall/"
@Test def neg_tailcall_t1672b = compileFile(negTailcallDir, "t1672b")
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?
+}
+*/