summaryrefslogtreecommitdiff
path: root/test/junit
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2015-11-09 12:33:16 +0100
committerLukas Rytz <lukas.rytz@gmail.com>2016-01-25 11:39:16 +0100
commit454af8cfedb3a126ffc4de4fe01e0b3ebe538a77 (patch)
tree3565105b152c93d749156aa65907c98fd773d333 /test/junit
parent0210d265f900941a0c17bb73f8de4c784ab27fc0 (diff)
downloadscala-454af8cfedb3a126ffc4de4fe01e0b3ebe538a77.tar.gz
scala-454af8cfedb3a126ffc4de4fe01e0b3ebe538a77.tar.bz2
scala-454af8cfedb3a126ffc4de4fe01e0b3ebe538a77.zip
Rewrite test: no type test on primitives in patmat
Diffstat (limited to 'test/junit')
-rw-r--r--test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala b/test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala
index cccab3a6d7..b53f7693dc 100644
--- a/test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala
+++ b/test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala
@@ -83,4 +83,23 @@ class PatmatBytecodeTest extends ClearAfterClass {
assert(getSingleMethod(c, "s1").instructions.count(_.opcode == TABLESWITCH) == 1, textify(c))
assert(getSingleMethod(c, "s2").instructions.count(_.opcode == TABLESWITCH) == 1, textify(c))
}
+
+ @Test
+ def optNoPrimitiveTypetest(): Unit = {
+ val code =
+ """case class Foo(x: Int, y: String)
+ |class C {
+ | def a = Foo(1, "a") match {
+ | case Foo(_: Int, y) => y
+ | }
+ |}
+ """.stripMargin
+ val c = compileClasses(optCompiler)(code).head
+
+ assertEquals(textify(findAsmMethod(c, "a")), getSingleMethod(c, "a").instructions.summary,
+ List(
+ NEW, DUP, ICONST_1, LDC, "<init>",
+ "y", ARETURN))
+ }
+
}