From 4c8aab0abbd8aee05866aae9c866f3e3142c5b85 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Mon, 10 Aug 2015 16:40:30 +1000 Subject: Test case for the status quo in specialized traits A deferred method in the generic interface ends up with a corresponding, generically substituted version in the specialized sub interface. This is superfluous and problematic when we start adding default methods to the interfaces. The subsequent commit will remove them. --- test/files/run/trait-default-specialize.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/files/run/trait-default-specialize.scala (limited to 'test/files/run/trait-default-specialize.scala') diff --git a/test/files/run/trait-default-specialize.scala b/test/files/run/trait-default-specialize.scala new file mode 100644 index 0000000000..7b57ddc1eb --- /dev/null +++ b/test/files/run/trait-default-specialize.scala @@ -0,0 +1,14 @@ +trait T[@specialized A] { + def t(a: A): Unit +} + +object Test { + def main(args: Array[String]): Unit = { + class TInt extends T[Int] { def t(a : Int) = println(a) } + val tMethods = classOf[TInt].getInterfaces.head.getMethods.filter(_.getName == "t") + println(tMethods.map(_.toString).sorted.mkString("\n")) + new TInt().t(0) + def call[A](t: T[A], a: A) = t.t(a) + call[Int](new TInt(), 0) + } +} -- cgit v1.2.3