diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t6260b.check | 7 | ||||
-rw-r--r-- | test/files/neg/t6260b.scala | 3 | ||||
-rw-r--r-- | test/files/neg/t6260c.check | 7 | ||||
-rw-r--r-- | test/files/neg/t6260c.scala | 4 | ||||
-rw-r--r-- | test/files/neg/t6385.check | 7 | ||||
-rw-r--r-- | test/files/pos/t6260a.scala | 15 | ||||
-rw-r--r-- | test/files/run/t6260b.scala | 13 | ||||
-rw-r--r-- | test/files/run/t6385.scala (renamed from test/files/neg/t6385.scala) | 4 | ||||
-rw-r--r-- | test/pending/run/t5866b.scala | 17 |
9 files changed, 68 insertions, 9 deletions
diff --git a/test/files/neg/t6260b.check b/test/files/neg/t6260b.check new file mode 100644 index 0000000000..3a7e8947aa --- /dev/null +++ b/test/files/neg/t6260b.check @@ -0,0 +1,7 @@ +t6260b.scala:3: error: bridge generated for member method apply: ()X in <$anon: () => X> +which overrides method apply: ()R in trait Function0 +clashes with definition of the member itself; +both have erased type ()Object +class Y { def f = new X("") or new X("") } + ^ +one error found diff --git a/test/files/neg/t6260b.scala b/test/files/neg/t6260b.scala new file mode 100644 index 0000000000..73e2e58f73 --- /dev/null +++ b/test/files/neg/t6260b.scala @@ -0,0 +1,3 @@ + +class X(val value: Object) extends AnyVal { def or(alt: => X): X = this } +class Y { def f = new X("") or new X("") } diff --git a/test/files/neg/t6260c.check b/test/files/neg/t6260c.check new file mode 100644 index 0000000000..cbbcfd1504 --- /dev/null +++ b/test/files/neg/t6260c.check @@ -0,0 +1,7 @@ +t6260c.scala:4: error: bridge generated for member method f: ()Option[A] in class Bar1 +which overrides method f: ()A in class Foo1 +clashes with definition of the member itself; +both have erased type ()Object + class Bar1[A] extends Foo1[Option[A]] { def f(): Option[A] = ??? } + ^ +one error found diff --git a/test/files/neg/t6260c.scala b/test/files/neg/t6260c.scala new file mode 100644 index 0000000000..02bf152376 --- /dev/null +++ b/test/files/neg/t6260c.scala @@ -0,0 +1,4 @@ +final class Option[+A](val value: A) extends AnyVal + +abstract class Foo1[A] { def f(): A } + class Bar1[A] extends Foo1[Option[A]] { def f(): Option[A] = ??? } diff --git a/test/files/neg/t6385.check b/test/files/neg/t6385.check deleted file mode 100644 index 93e51e8927..0000000000 --- a/test/files/neg/t6385.check +++ /dev/null @@ -1,7 +0,0 @@ -t6385.scala:12: error: bridge generated for member method x: ()C[T] in class C -which overrides method x: ()C[T] in trait AA -clashes with definition of the member itself; -both have erased type ()Object - def x = this - ^ -one error found diff --git a/test/files/pos/t6260a.scala b/test/files/pos/t6260a.scala new file mode 100644 index 0000000000..194294e981 --- /dev/null +++ b/test/files/pos/t6260a.scala @@ -0,0 +1,15 @@ +final class Option[+A](val value: A) extends AnyVal + +// Was: sandbox/test.scala:21: error: bridge generated for member method f: ()Option[A] in class Bar +// which overrides method f: ()Option[A] in class Foo" +abstract class Foo[A] { def f(): Option[A] } + class Bar[A] extends Foo[A] { def f(): Option[A] = ??? } + +// User reported this as erroneous but I couldn't reproduce with 2.10.{0,1,2,3} +// https://issues.scala-lang.org/browse/SI-6260?focusedCommentId=64764&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-64764 +// I suspect he whittled down the example too far. +class Wrapper(val value: Int) extends AnyVal +abstract class Test { def check(the: Wrapper): Boolean } +object T { + new Test { def check(the: Wrapper) = true } +} diff --git a/test/files/run/t6260b.scala b/test/files/run/t6260b.scala new file mode 100644 index 0000000000..dd2cf4bc4e --- /dev/null +++ b/test/files/run/t6260b.scala @@ -0,0 +1,13 @@ +class C[A](val a: A) extends AnyVal + +class DD { + def foo(c: C[String]) = () + def bar[A <: String](c: C[A]) = () + def baz[A](c: C[A]) = () +} + +object Test extends App { + classOf[DD].getMethod("foo", classOf[String]) + classOf[DD].getMethod("bar", classOf[String]) + classOf[DD].getMethod("baz", classOf[Object]) +} diff --git a/test/files/neg/t6385.scala b/test/files/run/t6385.scala index cec58eec9e..24fc3cd768 100644 --- a/test/files/neg/t6385.scala +++ b/test/files/run/t6385.scala @@ -1,8 +1,8 @@ -object N { +object Test { def main(args: Array[String]) { val y: AA[Int] = C(2) val c: Int = y.x.y - println(c) + assert(c == 2) } } trait AA[T] extends Any { diff --git a/test/pending/run/t5866b.scala b/test/pending/run/t5866b.scala new file mode 100644 index 0000000000..44d8b114b8 --- /dev/null +++ b/test/pending/run/t5866b.scala @@ -0,0 +1,17 @@ +class Foo(val d: Double) extends AnyVal { + override def toString = s"Foo($d)" +} + +class Bar(val d: String) extends AnyVal { + override def toString = s"Foo($d)" +} + +object Test { + def main(args: Array[String]): Unit = { + val f: Foo = {val n: Any = null; n.asInstanceOf[Foo]} + println(f) + + val b: Bar = {val n: Any = null; n.asInstanceOf[Bar]} + println(b) + } +} |