summaryrefslogtreecommitdiff
path: root/test/files/run/t7932.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/t7932.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/t7932.scala')
-rw-r--r--test/files/run/t7932.scala25
1 files changed, 21 insertions, 4 deletions
diff --git a/test/files/run/t7932.scala b/test/files/run/t7932.scala
index 8743abff88..e6bdbf2417 100644
--- a/test/files/run/t7932.scala
+++ b/test/files/run/t7932.scala
@@ -1,11 +1,28 @@
+import scala.language.higherKinds
+
class Category[M[_, _]]
-trait M[F] {
+
+trait M1[F] {
type X[a, b] = F
def category: Category[X] = null
def category1: Category[Tuple2] = null
}
-abstract class C extends M[Float]
+
+// The second trait is needed to make sure there's a forwarder generated in C.
+// otherwise the trait methods are just the inherited default methods from M1.
+trait M2[F] { self: M1[F] =>
+ override def category: Category[X] = null
+ override def category1: Category[Tuple2] = null
+}
+
+abstract class C extends M1[Float] with M2[Float]
+
object Test extends App {
- val ms = classOf[C].getMethods.filter(_.getName.startsWith("category"))
- println(ms.map(_.toGenericString).sorted.mkString("\n"))
+ def t(c: Class[_]) = {
+ val ms = c.getMethods.filter(_.getName.startsWith("category"))
+ println(ms.map(_.toGenericString).sorted.mkString("\n"))
+ }
+ t(classOf[C])
+ t(classOf[M1[_]])
+ t(classOf[M2[_]])
}