Skip to content

Commit b7456f0

Browse files
committed
Merge pull request scala#4965 from lrytz/t8790
SI-8790 test case
2 parents 7c25282 + 738f273 commit b7456f0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/junit/scala/tools/nsc/backend/jvm/opt/MethodLevelOptsTest.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,4 +756,24 @@ class MethodLevelOptsTest extends ClearAfterClass {
756756
val List(c) = compileClasses(methodOptCompiler)(code)
757757
assertNoInvoke(getSingleMethod(c, "compare"))
758758
}
759+
760+
@Test
761+
def t8790(): Unit = {
762+
val code =
763+
"""class C {
764+
| def t(x: Int, y: Int): String = (x, y) match {
765+
| case (7, 8) => "a"
766+
| case _ => "b"
767+
| }
768+
|}
769+
""".stripMargin
770+
val List(c) = compileClasses(methodOptCompiler)(code)
771+
772+
assertEquals(getSingleMethod(c, "t").instructions.summary, List(
773+
BIPUSH, ILOAD, IF_ICMPNE,
774+
BIPUSH, ILOAD, IF_ICMPNE,
775+
LDC, ASTORE, GOTO,
776+
-1, LDC, ASTORE,
777+
-1, ALOAD, ARETURN))
778+
}
759779
}

0 commit comments

Comments
 (0)