Skip to content

Commit 82c068c

Browse files
committed
Enhance bytecode test to verify absence of NEW instruction in method f1
1 parent d614d0b commit 82c068c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,14 @@ class DottyBytecodeTests extends DottyBytecodeTest {
16171617
""".stripMargin
16181618
checkBCode(code) { dir =>
16191619
val c = loadClassNode(dir.lookupName("C.class", directory = false).input)
1620-
assertNoInvoke(getMethod(c, "f1"), "scala/Tuple2$", "apply") // no Tuple2.apply call
1620+
val f1 = getMethod(c, "f1")
1621+
assertNoInvoke(f1, "scala/Tuple2$", "apply") // no Tuple2.apply call
1622+
// no `new` instruction
1623+
val hasNew = instructionsFromMethod(f1).exists {
1624+
case Op(Opcodes.NEW) => true
1625+
case _ => false
1626+
}
1627+
assertFalse("f1 should not have NEW instruction", hasNew)
16211628
}
16221629
}
16231630

0 commit comments

Comments
 (0)