diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-04-05 22:01:43 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-04-12 12:01:31 +0200 |
commit | 33e71061d63d08ee23e28d9a43ad601afa74e043 (patch) | |
tree | 83c4279524ae3aa6d5a270fc6bd1662102742a26 /test/files/run/t6554.scala | |
parent | b932419f07c0d747d868ebc3b51ccc54573a5827 (diff) | |
download | scala-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.scala | 12 |
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 |