summaryrefslogtreecommitdiff
path: root/test/files/run/t6554.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-04-05 22:01:43 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2016-04-12 12:01:31 +0200
commit33e71061d63d08ee23e28d9a43ad601afa74e043 (patch)
tree83c4279524ae3aa6d5a270fc6bd1662102742a26 /test/files/run/t6554.scala
parentb932419f07c0d747d868ebc3b51ccc54573a5827 (diff)
downloadscala-33e71061d63d08ee23e28d9a43ad601afa74e043.tar.gz
scala-33e71061d63d08ee23e28d9a43ad601afa74e043.tar.bz2
scala-33e71061d63d08ee23e28d9a43ad601afa74e043.zip
SD-98 don't emit unnecessary mixin forwarders
In most cases when a class inherits a concrete method from a trait we don't need to generate a forwarder to the default method in the class. t5148 is moved to pos as it compiles without error now. the error message ("missing or invalid dependency") is still tested by t6440b.
Diffstat (limited to 'test/files/run/t6554.scala')
-rw-r--r--test/files/run/t6554.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/files/run/t6554.scala b/test/files/run/t6554.scala
index 5d29d16666..eed139fea6 100644
--- a/test/files/run/t6554.scala
+++ b/test/files/run/t6554.scala
@@ -1,8 +1,14 @@
-trait Foo[A] {
+trait T1[A] {
def minBy[B](b: B): A = ???
}
-
-class Bar extends Foo[Int]
+
+// The second trait is needed to make sure there's a forwarder generated in Bar.
+// otherwise Bar.minBy is just the inherited default method from T1.
+trait T2[A] { self: T1[A] =>
+ override def minBy[B](b: B): A = ???
+}
+
+class Bar extends T1[Int] with T2[Int]
object Test extends App {
val sigs = classOf[Bar].getDeclaredMethods.map(m => s"${m.toString} / ${m.toGenericString}").sorted