diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2015-11-06 17:12:26 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-01-25 10:36:12 +0100 |
commit | e49fda4fab463da13e084d1deeb6f1a58e0041d1 (patch) | |
tree | c08c32bd384b7d791404a52c2b020f58e4e9f1c5 /test/junit | |
parent | a8d97403928983f72db66c6dab1354e7c89fe343 (diff) | |
download | scala-e49fda4fab463da13e084d1deeb6f1a58e0041d1.tar.gz scala-e49fda4fab463da13e084d1deeb6f1a58e0041d1.tar.bz2 scala-e49fda4fab463da13e084d1deeb6f1a58e0041d1.zip |
Rewrite test for SI-6955
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala | 28 |
1 files changed, 28 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 554e8c0150..cccab3a6d7 100644 --- a/test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala +++ b/test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala @@ -55,4 +55,32 @@ 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 t6955(): Unit = { + val code = + """class C { + | type Tag = Byte + | + | def s1(i: Tag): Int = i match { // notice type of i is Tag = Byte + | case 1 => 1 + | case 2 => 2 + | case 3 => 3 + | case _ => 0 + | } + | + | // this worked before, should keep working + | def s2(i: Byte): Int = i match { + | case 1 => 1 + | case 2 => 2 + | case 3 => 3 + | case _ => 0 + | } + |} + """.stripMargin + + val List(c) = compileClasses(compiler)(code) + assert(getSingleMethod(c, "s1").instructions.count(_.opcode == TABLESWITCH) == 1, textify(c)) + assert(getSingleMethod(c, "s2").instructions.count(_.opcode == TABLESWITCH) == 1, textify(c)) + } } |