Files
kotlin-fork/compiler/testData/codegen/box/checkcastOptimization/kt47851a.kt
T
Ilya Chernikov 78ca733c38 FIR JS: add K2 variants of all other JS tests
except tests that are not possible to add without some modifications in
the test infra. See todos on the commented-out test declarations
2022-11-12 16:28:24 +01:00

30 lines
838 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
// FIR status: result.getMethod OK in FE1.0, unresolved in FIR
// FULL_JDK
val defaultStringConverter = fun(s: String): Any {
var result: Any = s
var m: Array<String>? = arrayOf("1", "2", "3", "4")
if (m != null) {
val fname = m[4]
try {
result = Class.forName(m[1])
if (fname != "") {
try {
val f = result.getField(fname)
result = f.get(null)
} catch (nfe: NoSuchFieldException) {
val meth = result.getMethod(fname)
}
}
} catch (cnfe: ClassNotFoundException) {
}
}
return result
}
// Just check that there's no VerifyError.
// Semantics is checked in kt47851.kt.
fun box() = "OK"