Add tests for property const initializers
Merge-request: KT-MR-8661 Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
3a9ca1c1eb
commit
e75d739c7a
+24
@@ -35689,6 +35689,30 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaGenericSynthProperty.kt")
|
||||
public void testJavaGenericSynthProperty() throws Exception {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// KT-56023
|
||||
// JS_IR: InterpreterError: Unsupported number of arguments for invocation as builtin function: four
|
||||
// NATIVE: in mode -Pkotlin.internal.native.test.mode=TWO_STAGE_MULTI_MODULE (default test mode), test fails as below
|
||||
// InterpreterError: Unsupported number of arguments for invocation as builtin function: four
|
||||
// in mode -Pkotlin.internal.native.test.mode=ONE_STAGE_MULTI_MODULE, test passes
|
||||
// IGNORE_BACKEND_K2: NATIVE, JS_IR
|
||||
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
const val four = 4
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
fun box(): String {
|
||||
if (four == 4)
|
||||
return "OK"
|
||||
else
|
||||
return four.toString()
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// KT-56023
|
||||
// JS_IR: IllegalStateException: CONST_VAL_WITH_NON_CONST_INITIALIZER: Const 'val' initializer should be a constant value at (7,18) in /lib.kt
|
||||
// NATIVE: test fails as below in both modes -Pkotlin.internal.native.test.mode=TWO_STAGE_MULTI_MODULE, -Pkotlin.internal.native.test.mode=ONE_STAGE_MULTI_MODULE
|
||||
// error: const 'val' initializer should be a constant value
|
||||
// IGNORE_BACKEND_K2: NATIVE, JS_IR
|
||||
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
const val four = 2 + 2
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
fun box(): String {
|
||||
if (four == 4)
|
||||
return "OK"
|
||||
else
|
||||
return four.toString()
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
val four = 2 + 2
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
fun box(): String {
|
||||
if (four == 4)
|
||||
return "OK"
|
||||
else
|
||||
return four.toString()
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// MODULE: lib1
|
||||
// FILE: lib1.kt
|
||||
fun initializer() = 4
|
||||
|
||||
// MODULE: lib2(lib1)
|
||||
// FILE: lib2.kt
|
||||
val four = initializer()
|
||||
|
||||
// MODULE: main(lib1, lib2)
|
||||
// FILE: main.kt
|
||||
fun box(): String {
|
||||
if (four == 4)
|
||||
return "OK"
|
||||
else
|
||||
return four.toString()
|
||||
}
|
||||
+24
@@ -34363,6 +34363,30 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaGenericSynthProperty.kt")
|
||||
public void testJavaGenericSynthProperty() throws Exception {
|
||||
|
||||
+24
@@ -35689,6 +35689,30 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaGenericSynthProperty.kt")
|
||||
public void testJavaGenericSynthProperty() throws Exception {
|
||||
|
||||
+20
@@ -29314,6 +29314,26 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaGenericSynthProperty.kt")
|
||||
public void testJavaGenericSynthProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/javaGenericSynthProperty.kt");
|
||||
|
||||
+24
@@ -25173,6 +25173,30 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10715.kt")
|
||||
public void testKt10715() throws Exception {
|
||||
|
||||
+24
@@ -25209,6 +25209,30 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10715.kt")
|
||||
public void testKt10715() throws Exception {
|
||||
|
||||
+24
@@ -25209,6 +25209,30 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10715.kt")
|
||||
public void testKt10715() throws Exception {
|
||||
|
||||
+24
@@ -25209,6 +25209,30 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10715.kt")
|
||||
public void testKt10715() throws Exception {
|
||||
|
||||
+24
@@ -28375,6 +28375,30 @@ public class K2NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTes
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10715.kt")
|
||||
public void testKt10715() throws Exception {
|
||||
|
||||
+24
@@ -28052,6 +28052,30 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt10715.kt")
|
||||
public void testKt10715() throws Exception {
|
||||
|
||||
Generated
+20
@@ -22517,6 +22517,26 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initializerOfConstValWithConst.kt")
|
||||
public void testInitializerOfConstValWithConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initializerOfConstValWithConstExpr.kt")
|
||||
public void testInitializerOfConstValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfConstValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initializerOfValWithConstExpr.kt")
|
||||
public void testInitializerOfValWithConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithConstExpr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initializerOfValWithNonConstExpr.kt")
|
||||
public void testInitializerOfValWithNonConstExpr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initializerOfValWithNonConstExpr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt10715.kt")
|
||||
public void testKt10715() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/kt10715.kt");
|
||||
|
||||
Reference in New Issue
Block a user