diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-11-16 15:57:11 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-11-16 15:57:11 -0800 |
commit | 52ec695a98608128be2429d813fc5a045a092988 (patch) | |
tree | c620fe7acb58fcbe59196153b9face7b1b80a3ed /test/files/run | |
parent | 6645fec23ab3ee7d12f5cfc7c474a42f0eb7ec15 (diff) | |
parent | a7cc894ff2b4c5b661890272ec401cde12da3f9e (diff) | |
download | scala-52ec695a98608128be2429d813fc5a045a092988.tar.gz scala-52ec695a98608128be2429d813fc5a045a092988.tar.bz2 scala-52ec695a98608128be2429d813fc5a045a092988.zip |
Merge pull request #1586 from retronym/ticket/6247
Optimize primitive Array(e1, ..., en)
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t6611.scala | 63 |
1 files changed, 59 insertions, 4 deletions
diff --git a/test/files/run/t6611.scala b/test/files/run/t6611.scala index c0297372f0..c295368aea 100644 --- a/test/files/run/t6611.scala +++ b/test/files/run/t6611.scala @@ -1,6 +1,61 @@ object Test extends App { - val a = Array("1") - val a2 = Array(a: _*) - a2(0) = "2" - assert(a(0) == "1") + locally { + val a = Array("1") + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array("1": Object) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(true) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1: Short) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1: Byte) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1L) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1f) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1d) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(()) + val a2 = Array(a: _*) + assert(a ne a2) + } } |