Skip to content

Commit ec84363

Browse files
committed
Rewrite test: no local for underscore
1 parent f4a74f7 commit ec84363

File tree

5 files changed

+19
-49
lines changed

5 files changed

+19
-49
lines changed

test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,23 @@ class PatmatBytecodeTest extends ClearAfterClass {
115115
val c = compileClasses(optCompiler)(code).head
116116
assert(!getSingleMethod(c, "a").instructions.exists(i => i.opcode == IFNULL || i.opcode == IFNONNULL), textify(findAsmMethod(c, "a")))
117117
}
118+
119+
@Test
120+
def optNoLoacalForUnderscore(): Unit = {
121+
val code =
122+
"""case class Foo(x: Any, y: String)
123+
|class C {
124+
| def a = Foo(1, "a") match {
125+
| case Foo(_: String, y) => y
126+
| }
127+
|}
128+
""".stripMargin
129+
val c = compileClasses(optCompiler)(code).head
130+
assertEquals(textify(findAsmMethod(c, "a")), getSingleMethod(c, "a").instructions.summary,
131+
List(NEW, DUP, ICONST_1, "boxToInteger", LDC, "<init>", ASTORE /*1*/,
132+
ALOAD /*1*/, "y", ASTORE /*2*/,
133+
ALOAD /*1*/, "x", INSTANCEOF, IFNE /*R*/,
134+
NEW, DUP, ALOAD /*1*/, "<init>", ATHROW,
135+
/*R*/ -1, ALOAD /*2*/, ARETURN))
136+
}
118137
}

test/pending/jvm/patmat_opt_ignore_underscore.check

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/pending/jvm/patmat_opt_ignore_underscore.flags

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/pending/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala

Lines changed: 0 additions & 29 deletions
This file was deleted.

test/pending/jvm/patmat_opt_ignore_underscore/test.scala

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)