summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-07-17 01:19:58 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-07-17 01:19:58 -0700
commit0cfd858a38ddf0ac83d9bbefe85110f88dc707c0 (patch)
treec35a1655b6139a931dc32246815e7017cdccfbe4 /test
parentd9629db638ab1c63ca1eb7170c84a34112235204 (diff)
parent7c42b5aa4de0d88e02b73bdcda49309bde834be6 (diff)
downloadscala-0cfd858a38ddf0ac83d9bbefe85110f88dc707c0.tar.gz
scala-0cfd858a38ddf0ac83d9bbefe85110f88dc707c0.tar.bz2
scala-0cfd858a38ddf0ac83d9bbefe85110f88dc707c0.zip
Merge pull request #915 from gkossakowski/SI-6035-specialized-flag
SI-6035: Specialization and separate compilation.
Diffstat (limited to 'test')
-rw-r--r--test/files/specialized/t6035.check1
-rw-r--r--test/files/specialized/t6035/first_1.scala5
-rw-r--r--test/files/specialized/t6035/second_2.scala13
3 files changed, 19 insertions, 0 deletions
diff --git a/test/files/specialized/t6035.check b/test/files/specialized/t6035.check
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/test/files/specialized/t6035.check
@@ -0,0 +1 @@
+0
diff --git a/test/files/specialized/t6035/first_1.scala b/test/files/specialized/t6035/first_1.scala
new file mode 100644
index 0000000000..1289e9f48e
--- /dev/null
+++ b/test/files/specialized/t6035/first_1.scala
@@ -0,0 +1,5 @@
+trait Foo[@specialized(Int) A] {
+ def foo(x: A): A
+}
+
+abstract class Inter extends Foo[Int]
diff --git a/test/files/specialized/t6035/second_2.scala b/test/files/specialized/t6035/second_2.scala
new file mode 100644
index 0000000000..fb317e2a6a
--- /dev/null
+++ b/test/files/specialized/t6035/second_2.scala
@@ -0,0 +1,13 @@
+class Baz extends Inter {
+ def foo(x: Int) = x + 1
+}
+
+object Test {
+ def main(args: Array[String]) {
+ // it's important that the type is Inter so we do not call Baz.foo(I)I directly!
+ val baz: Inter = new Baz
+ // here we should go through specialized version of foo and thus have zero boxing
+ baz.foo(1)
+ println(runtime.BoxesRunTime.integerBoxCount)
+ }
+}