[FIR] Allow to evaluate top level const properties in Java world

#KT-57802
This commit is contained in:
Ivan Kylchik
2023-06-26 12:48:18 +02:00
committed by Space Team
parent 886ef1a4b4
commit 7935b2bdb1
11 changed files with 194 additions and 29 deletions
@@ -0,0 +1,18 @@
// TARGET_BACKEND: JVM
// FILE: Bar.java
package one.two;
public class Bar {
public static final int BAR = MainKt.FOO + 1;
}
// FILE: Main.kt
package one.two
const val FOO = <!EVALUATED("1")!>1<!>
const val BAZ = <!EVALUATED("3")!>Bar.BAR + 1<!>
fun box(): String {
return "OK"
}
@@ -0,0 +1,31 @@
// TARGET_BACKEND: JVM
// FILE: Bar.java
package one.two;
public class Bar {
public static final int BAR = Foo.FOO + 1;
}
// FILE: Boo.java
package one.two;
public class Boo {
public static final int BOO = Foo.BAZ + 1;
}
// FILE: Main.kt
package one.two
class Foo {
companion object {
const val FOO = <!EVALUATED("1")!>1<!>
const val BAZ = <!EVALUATED("3")!>Bar.BAR + 1<!>
const val DOO = <!EVALUATED("5")!>Boo.BOO + 1<!>
}
}
fun box(): String {
return "OK"
}