[JS] Fix typeOf for some reified type parameters
Fix getting kType metadata in cases when corresponding jsClass value is passed through temporary variable. This can happen when jsClass expression is not consided trivial by local variable optimizer. This happens for object declarations from different modules, for example kotlin.Unit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.ExperimentalStdlibApi
|
||||
// TARGET_BACKEND: JS
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.typeOf
|
||||
|
||||
fun sideEffects() {
|
||||
println("Side effect")
|
||||
}
|
||||
|
||||
inline fun <reified T> foo(): String {
|
||||
sideEffects()
|
||||
val x = typeOf<T>().toString()
|
||||
return x
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (foo<kotlin.Unit>() != "Unit")
|
||||
return "FAIL"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user