[KJS FE] Allow using typeOf with non-reified type parameters

#KT-38771 fixed
This commit is contained in:
Zalim Bashorov
2020-07-08 16:20:23 +03:00
parent 9d362875da
commit ca37c6bfe6
15 changed files with 92 additions and 109 deletions
@@ -1,35 +0,0 @@
// !USE_EXPERIMENTAL: kotlin.ExperimentalStdlibApi
// !LANGUAGE: +ProhibitNonReifiedArraysAsReifiedTypeArguments
import kotlin.reflect.typeOf
inline fun <X, reified Y, Z : Y> test1() {
<!UNSUPPORTED!>typeOf<!><<!TYPE_PARAMETER_AS_REIFIED!>X<!>>()
<!UNSUPPORTED!>typeOf<!><List<X>>()
<!UNSUPPORTED!>typeOf<!><<!TYPE_PARAMETER_AS_REIFIED_ARRAY!>Array<X?><!>>()
typeOf<Y>()
<!UNSUPPORTED!>typeOf<!><<!TYPE_PARAMETER_AS_REIFIED!>Z<!>>()
<!UNSUPPORTED!>typeOf<!><List<Z>?>()
<!UNSUPPORTED!>typeOf<!><<!TYPE_PARAMETER_AS_REIFIED_ARRAY!>Array<Z><!>>()
}
class Test2<W> {
fun test2() {
<!UNSUPPORTED!>typeOf<!><<!TYPE_PARAMETER_AS_REIFIED!>W<!>>()
<!UNSUPPORTED!>typeOf<!><List<W?>>()
<!UNSUPPORTED!>typeOf<!><<!TYPE_PARAMETER_AS_REIFIED_ARRAY!>Array<W><!>>()
}
}
inline fun <reified U> f() {
typeOf<U>()
}
fun <T> test3() {
// We don't report anything here because we can't know in frontend how the corresponding type parameter is used in f
f<List<T>>()
}
@@ -1,13 +0,0 @@
package
public inline fun </*0*/ reified U> f(): kotlin.Unit
public inline fun </*0*/ X, /*1*/ reified Y, /*2*/ Z : Y> test1(): kotlin.Unit
public fun </*0*/ T> test3(): kotlin.Unit
public final class Test2</*0*/ W> {
public constructor Test2</*0*/ W>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun test2(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}