Add test for KT-19246
The issue was fixed by https://github.com/jetbrains/kotlin/commit/904c7f9c640ccb38c0becb40bd3b5dad3ac921bd
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
enum class ResultType constructor(val reason: String) {
|
||||||
|
SOMETHING("123"),
|
||||||
|
OK("OK"),
|
||||||
|
UNKNOWN("FAIL");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getByVal(reason: String): ResultType {
|
||||||
|
return ResultType.values().firstOrDefault({ it.reason == reason }, UNKNOWN)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <T> Array<out T>.firstOrDefault(predicate: (T) -> Boolean, default: T): T {
|
||||||
|
return firstOrNull(predicate) ?: default
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String = ResultType.getByVal("OK").reason
|
||||||
+6
@@ -2722,6 +2722,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt19246.kt")
|
||||||
|
public void testKt19246() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19246.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/classLiteral")
|
@TestMetadata("compiler/testData/codegen/box/classLiteral")
|
||||||
|
|||||||
@@ -2722,6 +2722,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt19246.kt")
|
||||||
|
public void testKt19246() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19246.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/classLiteral")
|
@TestMetadata("compiler/testData/codegen/box/classLiteral")
|
||||||
|
|||||||
@@ -2722,6 +2722,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt19246.kt")
|
||||||
|
public void testKt19246() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19246.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/classLiteral")
|
@TestMetadata("compiler/testData/codegen/box/classLiteral")
|
||||||
|
|||||||
@@ -3274,6 +3274,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt19246.kt")
|
||||||
|
public void testKt19246() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19246.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/classLiteral")
|
@TestMetadata("compiler/testData/codegen/box/classLiteral")
|
||||||
|
|||||||
Reference in New Issue
Block a user