Add test on break in when without label
^KT-42262 fixed
This commit is contained in:
Generated
+5
@@ -31997,6 +31997,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/when/sealedWhenInitialization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchBreakNoLabel.kt")
|
||||
public void testSwitchBreakNoLabel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchBreakNoLabel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchOptimizationDense.kt")
|
||||
public void testSwitchOptimizationDense() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchOptimizationDense.kt");
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
fun test(): Boolean {
|
||||
var flagOuter = false
|
||||
var flagInner = false
|
||||
for (i in 0..5) {
|
||||
when (i) {
|
||||
1 -> Unit
|
||||
2 -> Unit
|
||||
3 -> {
|
||||
for (j in 0..5) {
|
||||
when (j) {
|
||||
1 -> Unit
|
||||
2 -> {
|
||||
flagInner = true
|
||||
break
|
||||
}
|
||||
else -> flagInner = false
|
||||
}
|
||||
}
|
||||
}
|
||||
4 -> {
|
||||
flagOuter = true
|
||||
break
|
||||
}
|
||||
else -> flagOuter = false
|
||||
}
|
||||
}
|
||||
|
||||
return flagOuter and flagInner
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val flag = test()
|
||||
return if (flag) "OK" else "fail1"
|
||||
}
|
||||
+5
@@ -33768,6 +33768,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/when/sealedWhenInitialization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchBreakNoLabel.kt")
|
||||
public void testSwitchBreakNoLabel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchBreakNoLabel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchOptimizationDense.kt")
|
||||
public void testSwitchOptimizationDense() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchOptimizationDense.kt");
|
||||
|
||||
+5
@@ -31402,6 +31402,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/when/sealedWhenInitialization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchBreakNoLabel.kt")
|
||||
public void testSwitchBreakNoLabel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchBreakNoLabel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchOptimizationDense.kt")
|
||||
public void testSwitchOptimizationDense() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchOptimizationDense.kt");
|
||||
|
||||
+5
@@ -31997,6 +31997,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/when/sealedWhenInitialization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchBreakNoLabel.kt")
|
||||
public void testSwitchBreakNoLabel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchBreakNoLabel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchOptimizationDense.kt")
|
||||
public void testSwitchOptimizationDense() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchOptimizationDense.kt");
|
||||
|
||||
Generated
+5
@@ -26003,6 +26003,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/when/sealedWhenInitialization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchBreakNoLabel.kt")
|
||||
public void testSwitchBreakNoLabel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchBreakNoLabel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchOptimizationDense.kt")
|
||||
public void testSwitchOptimizationDense() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchOptimizationDense.kt");
|
||||
|
||||
Generated
+5
@@ -26003,6 +26003,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/when/sealedWhenInitialization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchBreakNoLabel.kt")
|
||||
public void testSwitchBreakNoLabel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchBreakNoLabel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchOptimizationDense.kt")
|
||||
public void testSwitchOptimizationDense() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchOptimizationDense.kt");
|
||||
|
||||
+5
@@ -26018,6 +26018,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/when/sealedWhenInitialization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchBreakNoLabel.kt")
|
||||
public void testSwitchBreakNoLabel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchBreakNoLabel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("switchOptimizationDense.kt")
|
||||
public void testSwitchOptimizationDense() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/when/switchOptimizationDense.kt");
|
||||
|
||||
Reference in New Issue
Block a user