[IR] Specify explicitly that classes from Java can be interpreted

In early prototypes of interpreter, it was easier to assume that
all classes from Java can be interpreted and fix something if not.
Check for Java declaration was done by checking that the package name is
starting with "java". But this is actually wrong and can lead to errors
when some code is declared in "java" something package, but is not from
Java stdlib.

#KT-60467 Fixed
This commit is contained in:
Ivan Kylchik
2023-07-19 12:40:55 +02:00
committed by Space Team
parent 43c66ee0e5
commit 30c00f7983
15 changed files with 160 additions and 7 deletions
@@ -0,0 +1,19 @@
// Can't be tested in JVM because frontend doesn't allow such code
// TARGET_BACKEND: JS_IR
// TARGET_BACKEND: NATIVE
// WITH_STDLIB
package java.lang
object Math {
const val E: Double = kotlin.math.<!EVALUATED("2.718281828459045")!>E<!>
const val PI: Double = kotlin.math.<!EVALUATED("3.141592653589793")!>PI<!>
const val OK: String = <!EVALUATED("OK")!>"OK"<!>
}
const val usageE = Math.<!EVALUATED("2.718281828459045")!>E<!>
const val usagePI = Math.<!EVALUATED("3.141592653589793")!>PI<!>
fun box(): String {
return Math.<!EVALUATED("OK")!>OK<!>
}