[FIR] Add diag test to verify const checker in Java world

Currently, this test is not working for FIR.

#KT-57802 Fixed
This commit is contained in:
Ivan Kylchik
2023-07-10 11:26:25 +02:00
committed by Space Team
parent 4334ae9da9
commit 69a888b431
7 changed files with 78 additions and 0 deletions
@@ -22805,6 +22805,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/modifiers/const/kt15913.kt");
}
@Test
@TestMetadata("kt57802.kt")
public void testKt57802() throws Exception {
runTest("compiler/testData/diagnostics/tests/modifiers/const/kt57802.kt");
}
@Test
@TestMetadata("stdlibConstFun.kt")
public void testStdlibConstFun() throws Exception {
@@ -22805,6 +22805,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/modifiers/const/kt15913.kt");
}
@Test
@TestMetadata("kt57802.kt")
public void testKt57802() throws Exception {
runTest("compiler/testData/diagnostics/tests/modifiers/const/kt57802.kt");
}
@Test
@TestMetadata("stdlibConstFun.kt")
public void testStdlibConstFun() throws Exception {
@@ -22805,6 +22805,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/modifiers/const/kt15913.kt");
}
@Test
@TestMetadata("kt57802.kt")
public void testKt57802() throws Exception {
runTest("compiler/testData/diagnostics/tests/modifiers/const/kt57802.kt");
}
@Test
@TestMetadata("stdlibConstFun.kt")
public void testStdlibConstFun() throws Exception {
@@ -22811,6 +22811,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/modifiers/const/kt15913.kt");
}
@Test
@TestMetadata("kt57802.kt")
public void testKt57802() throws Exception {
runTest("compiler/testData/diagnostics/tests/modifiers/const/kt57802.kt");
}
@Test
@TestMetadata("stdlibConstFun.kt")
public void testStdlibConstFun() throws Exception {
@@ -0,0 +1,24 @@
// TARGET_BACKEND: JVM
// FILE: Bar.java
package one.two;
public class Bar {
public static final int BAR1 = SOME_WRONG_EXPRESSION;
public static final int BAR2 = MainKt.FOO + 1;
public static final int BAR3 = Doo.DOO + 1;
}
// FILE: Main.kt
package one.two
const val FOO = 1
class Doo {
companion object {
const val DOO = 1
}
}
const val BAZ1 = Bar.BAR1 + 1
const val BAZ2 = Bar.BAR2 + 1
const val BAZ3 = Bar.BAR3 + 1
@@ -0,0 +1,24 @@
// TARGET_BACKEND: JVM
// FILE: Bar.java
package one.two;
public class Bar {
public static final int BAR1 = SOME_WRONG_EXPRESSION;
public static final int BAR2 = MainKt.FOO + 1;
public static final int BAR3 = Doo.DOO + 1;
}
// FILE: Main.kt
package one.two
const val FOO = 1
class Doo {
companion object {
const val DOO = 1
}
}
const val BAZ1 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>Bar.BAR1 + 1<!>
const val BAZ2 = Bar.BAR2 + 1
const val BAZ3 = Bar.BAR3 + 1
@@ -22811,6 +22811,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/modifiers/const/kt15913.kt");
}
@Test
@TestMetadata("kt57802.kt")
public void testKt57802() throws Exception {
runTest("compiler/testData/diagnostics/tests/modifiers/const/kt57802.kt");
}
@Test
@TestMetadata("stdlibConstFun.kt")
public void testStdlibConstFun() throws Exception {