diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-03 13:34:20 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-03 23:25:13 +0100 |
commit | dad886659faca4fba2d4937c9bc6780591b02c27 (patch) | |
tree | 0fcb5ab4e20c6570bd15cf773c9ec9d1d74f7e81 /test | |
parent | b5e3eafabe4b9cfe1e6de9eeedfe1140afeaa4eb (diff) | |
download | scala-dad886659faca4fba2d4937c9bc6780591b02c27.tar.gz scala-dad886659faca4fba2d4937c9bc6780591b02c27.tar.bz2 scala-dad886659faca4fba2d4937c9bc6780591b02c27.zip |
SI-6611 Tighten up an unsafe array optimization
The net was cast too wide and was unsafely optimizing away array
copies.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/instrumented/t6611.check | 1 | ||||
-rw-r--r-- | test/files/instrumented/t6611.scala | 13 | ||||
-rw-r--r-- | test/files/run/t6611.scala | 6 |
3 files changed, 20 insertions, 0 deletions
diff --git a/test/files/instrumented/t6611.check b/test/files/instrumented/t6611.check new file mode 100644 index 0000000000..5cd691e93a --- /dev/null +++ b/test/files/instrumented/t6611.check @@ -0,0 +1 @@ +Method call statistics: diff --git a/test/files/instrumented/t6611.scala b/test/files/instrumented/t6611.scala new file mode 100644 index 0000000000..821d5f3fbf --- /dev/null +++ b/test/files/instrumented/t6611.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.instrumented.Instrumentation._ + +object Test { + def main(args: Array[String]) { + startProfiling() + + // tests optimization in Cleanup for varargs reference arrays + val a = Array("") + + stopProfiling() + printStatistics() + } +} diff --git a/test/files/run/t6611.scala b/test/files/run/t6611.scala new file mode 100644 index 0000000000..c0297372f0 --- /dev/null +++ b/test/files/run/t6611.scala @@ -0,0 +1,6 @@ +object Test extends App { + val a = Array("1") + val a2 = Array(a: _*) + a2(0) = "2" + assert(a(0) == "1") +} |