summaryrefslogtreecommitdiff
path: root/test/files/run/trait-default-specialize.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-08-10 16:40:30 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-08-11 14:26:23 +1000
commit4c8aab0abbd8aee05866aae9c866f3e3142c5b85 (patch)
tree594d67b40a49a68ee9d95abab7deaac11614613a /test/files/run/trait-default-specialize.scala
parent2f7a622e2de688f6b79bb6270020bc99445bada8 (diff)
downloadscala-4c8aab0abbd8aee05866aae9c866f3e3142c5b85.tar.gz
scala-4c8aab0abbd8aee05866aae9c866f3e3142c5b85.tar.bz2
scala-4c8aab0abbd8aee05866aae9c866f3e3142c5b85.zip
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.
Diffstat (limited to 'test/files/run/trait-default-specialize.scala')
-rw-r--r--test/files/run/trait-default-specialize.scala14
1 files changed, 14 insertions, 0 deletions
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)
+ }
+}