File tree 1 file changed +22
-0
lines changed
compiler/test/dotty/tools/backend/jvm
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,28 @@ class DottyBytecodeTests extends DottyBytecodeTest {
200
200
}
201
201
}
202
202
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
+
203
225
@ Test def switchOnUnionOfIntSingletons = {
204
226
val source =
205
227
"""
You can’t perform that action at this time.
0 commit comments