Skip to content

Commit 7f9b5d2

Browse files
committed
Simplify test
1 parent c0fc53a commit 7f9b5d2

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

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

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -285,26 +285,24 @@ class InlineBytecodeTests extends DottyBytecodeTest {
285285
// Testing that a is not boxed
286286
@Test def i4522 = {
287287
val source = """class Foo {
288-
| def fun: Int = {
289-
| var a = 10
290-
| rewrite def f(arg: => Unit) = {
291-
| a += 1
292-
| arg
293-
| }
294-
|
295-
| f {
296-
| return a
297-
| }
298-
| a
299-
| }
300-
|}
288+
| def test: Int = {
289+
| var a = 10
290+
|
291+
| rewrite def f() = {
292+
| a += 1
293+
| }
294+
|
295+
| f()
296+
| a
297+
| }
298+
|}
301299
""".stripMargin
302300

303301
checkBCode(source) { dir =>
304302
val clsIn = dir.lookupName("Foo.class", directory = false).input
305303
val clsNode = loadClassNode(clsIn)
306304

307-
val fun = getMethod(clsNode, "fun")
305+
val fun = getMethod(clsNode, "test")
308306
val instructions = instructionsFromMethod(fun)
309307
val expected =
310308
List(
@@ -316,12 +314,6 @@ class InlineBytecodeTests extends DottyBytecodeTest {
316314
, VarOp(ISTORE, 1)
317315
, VarOp(ILOAD, 1)
318316
, Op(IRETURN)
319-
, Label(8)
320-
, FrameEntry(0, List(), List("java/lang/Throwable"))
321-
, Op(ATHROW)
322-
, Label(11)
323-
, FrameEntry(4, List(), List("java/lang/Throwable"))
324-
, Op(ATHROW)
325317
)
326318
assert(instructions == expected,
327319
"`f` was not properly inlined in `fun`\n" + diffInstructions(instructions, expected))

0 commit comments

Comments
 (0)