Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.fir.kt
T
Mikhail Glukhikh 684bdc44bb FIR: add implementation of reified type parameter references
This adds support of T::class.java for reified type parameters
2019-12-17 17:28:01 +03:00

18 lines
497 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_VARIABLE -DEPRECATION
// !WITH_NEW_INFERENCE
inline fun<reified T> foo(block: () -> T): String = block().toString()
inline fun <reified T: Any> javaClass(): Class<T> = T::class.java
fun box() {
val a = arrayOf(null!!)
val b = Array<Nothing?>(5) { null!! }
val c = foo() { null!! }
val d = foo<Any> { null!! }
val e = foo { "1" as Nothing }
val e1 = foo { "1" as Nothing? }
val f = javaClass<Nothing>()
}