diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-09-17 15:39:11 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-09-17 15:39:11 +0200 |
commit | 2bb960c68091b804d8ace1f76460279f6567a193 (patch) | |
tree | 2b8e953d653c90c29216b4b5b41eabe40ecf83a1 /test | |
parent | 9dbc321504ad5550638d6d7c2b3cd2f98273cf74 (diff) | |
download | scala-2bb960c68091b804d8ace1f76460279f6567a193.tar.gz scala-2bb960c68091b804d8ace1f76460279f6567a193.tar.bz2 scala-2bb960c68091b804d8ace1f76460279f6567a193.zip |
SI-7852 Test to show the status quo bytecode for "" == ...
Will be somewhat leaner after the next commit.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t7852.check | 30 | ||||
-rw-r--r-- | test/files/run/t7852.flags | 1 | ||||
-rw-r--r-- | test/files/run/t7852.scala | 20 |
3 files changed, 51 insertions, 0 deletions
diff --git a/test/files/run/t7852.check b/test/files/run/t7852.check new file mode 100644 index 0000000000..fdced88fa8 --- /dev/null +++ b/test/files/run/t7852.check @@ -0,0 +1,30 @@ +class scala.tools.asm.tree.MethodNode + LDC "" + ALOAD 0 + INVOKEVIRTUAL java/lang/Object.toString ()Ljava/lang/String; + ASTORE 1 + DUP + IFNONNULL L0 + POP + ALOAD 1 + IFNULL L1 + GOTO L2 + L0 + FRAME FULL [Lean java/lang/String] [java/lang/String] + ALOAD 1 + INVOKEVIRTUAL java/lang/Object.equals (Ljava/lang/Object;)Z + IFEQ L2 + L1 + FRAME SAME + ICONST_1 + GOTO L3 + L2 + FRAME SAME + ICONST_0 + L3 + FRAME SAME1 I + POP + RETURN + MAXSTACK = 2 + MAXLOCALS = 2 + diff --git a/test/files/run/t7852.flags b/test/files/run/t7852.flags new file mode 100644 index 0000000000..f6262fd3e0 --- /dev/null +++ b/test/files/run/t7852.flags @@ -0,0 +1 @@ +-Ynooptimise diff --git a/test/files/run/t7852.scala b/test/files/run/t7852.scala new file mode 100644 index 0000000000..eed211c7bc --- /dev/null +++ b/test/files/run/t7852.scala @@ -0,0 +1,20 @@ +import scala.tools.partest.BytecodeTest +import scala.tools.asm.util._ +import scala.tools.nsc.util.stringFromWriter + +object Test extends BytecodeTest { + def show { + val classNode = loadClassNode("Lean") + val meth = getMethod(classNode, "foo") + println(meth.getClass) + val textifier = new Textifier() + meth.accept(new TraceMethodVisitor(textifier)) + println(stringFromWriter(w => textifier.print(w))) + } +} + +class Lean { + def foo { + "" == toString + } +} |