[IR] Create special checker that will analyze name methods

We can insert all this logic into `IrCompileTimeChecker` but it is
a little bit specific and looks like it is nicer to just extract it.
This commit is contained in:
Ivan Kylchik
2023-04-27 17:41:33 +02:00
committed by Space Team
parent 104ac4bd69
commit 1fd8ef801e
9 changed files with 130 additions and 54 deletions
@@ -0,0 +1,36 @@
// !LANGUAGE: +IntrinsicConstEvaluation
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
fun <T> T.id() = this
class A {
val a = ""
fun b() = ""
init {
println("A init")
}
fun test() {
val a = A::a.<!EVALUATED("a")!>name<!>
val b = A::b.<!EVALUATED("b")!>name<!>
val c = ::A.<!EVALUATED("<init>")!>name<!>
val d = this::a.name
val e = A()::b.name
val f = getA()::b.name
val temp = A()
val g = temp::b.name
}
fun getA(): A = A()
}
// STOP_EVALUATION_CHECKS
fun box(): String {
A().test()
return "OK"
}