diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-02-09 16:34:38 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-02-09 16:34:38 +0000 |
commit | 47bea31877a637c3c0510b6fc714a273ee8d9b64 (patch) | |
tree | 155ce5279c0f98c8b66550469da0f2643f7da07b /test | |
parent | 7ac66ec3b45562118b24a5dc8c16a7475d3e828f (diff) | |
download | scala-47bea31877a637c3c0510b6fc714a273ee8d9b64.tar.gz scala-47bea31877a637c3c0510b6fc714a273ee8d9b64.tar.bz2 scala-47bea31877a637c3c0510b6fc714a273ee8d9b64.zip |
A missing test.
No review
Diffstat (limited to 'test')
-rw-r--r-- | test/files/specialized/arrays-traits.check | 6 | ||||
-rw-r--r-- | test/files/specialized/arrays-traits.scala | 46 |
2 files changed, 52 insertions, 0 deletions
diff --git a/test/files/specialized/arrays-traits.check b/test/files/specialized/arrays-traits.check new file mode 100644 index 0000000000..92af4f13e1 --- /dev/null +++ b/test/files/specialized/arrays-traits.check @@ -0,0 +1,6 @@ +0 +0 +0 +1 +2 +1
\ No newline at end of file diff --git a/test/files/specialized/arrays-traits.scala b/test/files/specialized/arrays-traits.scala new file mode 100644 index 0000000000..ee62622635 --- /dev/null +++ b/test/files/specialized/arrays-traits.scala @@ -0,0 +1,46 @@ + + + +import runtime.ScalaRunTime._ + + + +trait SuperS[@specialized(AnyRef) T] { + def arr: Array[T] + def foo() = arr(0) + def bar(b: Array[T]) = b(0) = arr(0) +} + + +class BaseS[@specialized(AnyRef) T](val arr: Array[T]) extends SuperS[T] { +} + + +trait SuperG[T] { + def arr: Array[T] + def foo() = arr(0) + def bar(b: Array[T]) = b(0) = arr(0) +} + + +class BaseG[T](val arr: Array[T]) extends SuperG[T] { +} + + +object Test { + + def main(args: Array[String]) { + (new BaseS(new Array[String](1)): SuperS[String]).foo + println(arrayApplyCount) + (new BaseS(new Array[String](1)): SuperS[String]).bar(new Array[String](1)) + println(arrayApplyCount) + println(arrayUpdateCount) + + (new BaseG(new Array[String](1)): SuperG[String]).foo + println(arrayApplyCount) + (new BaseG(new Array[String](1)): SuperG[String]).bar(new Array[String](1)) + println(arrayApplyCount) + println(arrayUpdateCount) + } + +} |