JS: Fix capturing class construction function for lambdas inside inline functions with reified type parameters (KT-13522).

This commit is contained in:
Anton Bannykh
2016-12-01 19:22:48 +03:00
parent 729a3a34b8
commit 6301e3ec30
5 changed files with 54 additions and 0 deletions
@@ -0,0 +1,15 @@
package foo
inline fun <reified T : Any> foo(): () -> JsClass<T> {
val T = 1
return { jsClass<T>() }
}
fun box(): String {
check(jsClass<A>(), foo<A>()())
check(jsClass<B>(), foo<B>()())
check(jsClass<O>(), foo<O>()())
check(jsClass<E>(), foo<E>()())
return "OK"
}
@@ -0,0 +1,19 @@
package foo
import kotlin.reflect.KClass
inline fun <reified T : Any> foo(b: Boolean = false): () -> KClass<T> {
if (b) {
val T = 1
}
return { T::class }
}
fun box(): String {
check(A::class, foo<A>()())
check(B::class, foo<B>()())
check(O::class, foo<O>()())
check(E::class, foo<E>()())
return "OK"
}