diff options
author | Martin Odersky <odersky@gmail.com> | 2016-05-03 11:23:24 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-05-19 08:32:48 +0200 |
commit | b26b725ef25a55a325b2c8a44c1ac67272632f14 (patch) | |
tree | d05eda39d405787a7b2ca651fea8fa2455bd19b7 /tests/neg | |
parent | 3a97b3fb546bc57afb8cbfadb27eb9e66b0842d1 (diff) | |
download | dotty-b26b725ef25a55a325b2c8a44c1ac67272632f14.tar.gz dotty-b26b725ef25a55a325b2c8a44c1ac67272632f14.tar.bz2 dotty-b26b725ef25a55a325b2c8a44c1ac67272632f14.zip |
Handle MergeErrors in RefChecks
Used to throw an uncaught merge error in checkAllOverrides
when compiling i1240c.scala.
Diffstat (limited to 'tests/neg')
-rw-r--r-- | tests/neg/i1240b.scala | 23 | ||||
-rw-r--r-- | tests/neg/i1240c.scala | 17 |
2 files changed, 26 insertions, 14 deletions
diff --git a/tests/neg/i1240b.scala b/tests/neg/i1240b.scala index 6987dbc96..2d23db614 100644 --- a/tests/neg/i1240b.scala +++ b/tests/neg/i1240b.scala @@ -1,17 +1,12 @@ -// yet another variant, testing super accessors - -trait T { - def foo[B](x: C[B]): C[B] +// yet another variant, testing type parameters +trait T[X] { + def foo(x: X): X } -abstract class A extends T { - 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} +abstract class A[X] extends T[X] { + def foo(x: X): X = {println("A.X"); x} + def foo(x: String): String = {println("A.String"); x} } -trait U extends T { - def foo[B](x: C[B]): C[B] = super.foo[B](x) -} -object Test extends A with U { - type C[X] = List[X] - def main(args: Array[String]) = foo(List("")) +trait U[X] extends T[X] { + abstract override def foo(x: X): X = super.foo(x) } +object Test extends A[String] with U[String] // error: accidental override diff --git a/tests/neg/i1240c.scala b/tests/neg/i1240c.scala new file mode 100644 index 000000000..89fded292 --- /dev/null +++ b/tests/neg/i1240c.scala @@ -0,0 +1,17 @@ +// yet another variant, testing super accessors +// (but exhibited a crash in RefChecks). + +trait T { + def foo[B](x: C[B]): C[B] +} +abstract class A extends T { + 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} +} +trait U extends T { + abstract override def foo[B](x: C[B]): C[B] = super.foo[B](x) +} +object Test extends A with U { + type C[X] = List[X] +} |