From 47bea31877a637c3c0510b6fc714a273ee8d9b64 Mon Sep 17 00:00:00 2001 From: Aleksandar Pokopec Date: Wed, 9 Feb 2011 16:34:38 +0000 Subject: A missing test. No review --- test/files/specialized/arrays-traits.check | 6 ++++ test/files/specialized/arrays-traits.scala | 46 ++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 test/files/specialized/arrays-traits.check create mode 100644 test/files/specialized/arrays-traits.scala 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) + } + +} -- cgit v1.2.3