Add test on break in when without label

^KT-42262 fixed
This commit is contained in:
Ilya Goncharov
2020-10-19 16:13:23 +03:00
parent a4b67f007f
commit 14d9aa1660
8 changed files with 70 additions and 0 deletions
@@ -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"
}
@@ -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");
@@ -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");
@@ -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");
@@ -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");
@@ -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");
@@ -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");