File tree 1 file changed +11
-5
lines changed
test-suite/shared/src/test/scala/org/scalajs/testsuite/compiler
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -418,10 +418,13 @@ class RegressionTest {
418
418
@ Test def switchMatchWithGuardAndResultTypeOfBoxedUnit_Issue1955 (): Unit = {
419
419
val bug = new Bug1955
420
420
bug.bug(2 , true )
421
- assertEquals(0 , bug.result)
421
+ assertEquals(22 , bug.result)
422
+ bug.bug(2 , false )
423
+ assertEquals(- 1 , bug.result)
422
424
bug.bug(1 , true )
423
425
assertEquals(579 , bug.result)
424
- assertThrows(classOf [MatchError ], bug.bug(2 , false ))
426
+ bug.bug(6 , true )
427
+ assertEquals(- 1 , bug.result)
425
428
}
426
429
427
430
@ Test def switchMatchWithGuardInStatementPosButWithNonUnitBranches_Issue4105 (): Unit = {
@@ -987,9 +990,12 @@ object RegressionTest {
987
990
}
988
991
989
992
def bug (x : Int , e : Boolean ): Unit = {
990
- x match {
991
- case 1 => doSomething(123 , 456 , ())
992
- case 2 if e =>
993
+ (x : @ switch) match {
994
+ case 1 => doSomething(123 , 456 , ())
995
+ case 2 if e => result = 22
996
+ case 3 => result = 33
997
+ case 4 => result = 44
998
+ case _ => result = - 1
993
999
}
994
1000
995
1001
if (false ) ()
You can’t perform that action at this time.
0 commit comments