[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:
Vendored
+36
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user