Skip to content

Commit 2c349c1

Browse files
committed
add test for union of Char
1 parent 3cbc15e commit 2c349c1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Diff for: compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala

+22
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,28 @@ class DottyBytecodeTests extends DottyBytecodeTest {
200200
}
201201
}
202202

203+
@Test def switchOnUnionOfChars = {
204+
val source =
205+
"""
206+
|object Foo {
207+
| def foo(ch: 'a' | 'b' | 'c' | 'd' | 'e'): Int = ch match {
208+
| case 'a' => 1
209+
| case 'b' => 2
210+
| case 'c' => 3
211+
| case 'd' => 4
212+
| case 'e' => 5
213+
| }
214+
|}
215+
""".stripMargin
216+
217+
checkBCode(source) { dir =>
218+
val moduleIn = dir.lookupName("Foo$.class", directory = false)
219+
val moduleNode = loadClassNode(moduleIn.input)
220+
val methodNode = getMethod(moduleNode, "foo")
221+
assert(verifySwitch(methodNode))
222+
}
223+
}
224+
203225
@Test def switchOnUnionOfIntSingletons = {
204226
val source =
205227
"""

0 commit comments

Comments
 (0)