diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2015-11-09 12:44:07 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-01-25 11:39:30 +0100 |
commit | f4a74f7eefb0521c0531f930ac8fd505953e0f50 (patch) | |
tree | bc2d5950c3dce5757ac93db163715a33064656c7 /test/junit | |
parent | 454af8cfedb3a126ffc4de4fe01e0b3ebe538a77 (diff) | |
download | scala-f4a74f7eefb0521c0531f930ac8fd505953e0f50.tar.gz scala-f4a74f7eefb0521c0531f930ac8fd505953e0f50.tar.bz2 scala-f4a74f7eefb0521c0531f930ac8fd505953e0f50.zip |
Rewrite test: no null in patmat
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala | 13 |
1 files changed, 13 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 b53f7693dc..5aac1f4656 100644 --- a/test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala +++ b/test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala @@ -102,4 +102,17 @@ class PatmatBytecodeTest extends ClearAfterClass { "y", ARETURN)) } + @Test + def optNoNullCheck(): Unit = { + val code = + """case class Foo(x: Any) + |class C { + | def a = (Foo(1): Any) match { + | case Foo(_: String) => + | } + |} + """.stripMargin + val c = compileClasses(optCompiler)(code).head + assert(!getSingleMethod(c, "a").instructions.exists(i => i.opcode == IFNULL || i.opcode == IFNONNULL), textify(findAsmMethod(c, "a"))) + } } |