summaryrefslogtreecommitdiff
path: root/test/files/run/t6288b-jump-position.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-12-11 18:59:27 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-12-12 07:19:54 +0100
commitf69b8468b76edc9f25a4cb97022a136be988b236 (patch)
tree11ee20533761c70f2b7bda9748e22ebda277acd2 /test/files/run/t6288b-jump-position.scala
parent79a43d78b27232be005755eb206fd9e4ce9a0625 (diff)
downloadscala-f69b8468b76edc9f25a4cb97022a136be988b236.tar.gz
scala-f69b8468b76edc9f25a4cb97022a136be988b236.tar.bz2
scala-f69b8468b76edc9f25a4cb97022a136be988b236.zip
SI-6288 Fix positioning of label jumps
ICode generation was assigning the position of the last label jump to all jumps to that particular label def. This problem is particularly annoying under the new pattern matcher: a breakpoint in the body of the final case will be triggered on the way out of the body of any other case. Thanks to @dragos for the expert guidance as we wended our way through GenICode to the troublesome code. Chalk up another bug for mutability. I believe that the ICode output should be stable enough to use a a .check file, if it proves otherwise we should make it so.
Diffstat (limited to 'test/files/run/t6288b-jump-position.scala')
-rw-r--r--test/files/run/t6288b-jump-position.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/files/run/t6288b-jump-position.scala b/test/files/run/t6288b-jump-position.scala
new file mode 100644
index 0000000000..e22a1ab120
--- /dev/null
+++ b/test/files/run/t6288b-jump-position.scala
@@ -0,0 +1,22 @@
+import scala.tools.partest.IcodeTest
+
+object Test extends IcodeTest {
+ override def code =
+ """object Case3 { // 01
+ | def unapply(z: Any): Option[Int] = Some(-1) // 02
+ | def main(args: Array[String]) { // 03
+ | ("": Any) match { // 04
+ | case x : String => // 05 Read: <linenumber> JUMP <target basic block id>
+ | println("case 0") // 06 expecting "6 JUMP 7", was "8 JUMP 7"
+ | case _ => // 07
+ | println("default") // 08 expecting "8 JUMP 7"
+ | } // 09
+ | println("done") // 10
+ | }
+ |}""".stripMargin
+
+ override def show() {
+ val lines1 = collectIcode("")
+ println(lines1 mkString "\n")
+ }
+}