[FIR] Implement REIFIED_TYPE_FORBIDDEN_SUBSTITUTION

This commit is contained in:
Ivan Kochurkin
2021-07-15 15:29:41 +03:00
committed by teamcityserver
parent bade6cb611
commit 173813f7cf
14 changed files with 59 additions and 23 deletions
@@ -39,8 +39,8 @@ fun test4(
) {}
fun test5() {
arrayOf<Nothing>()
Array<Nothing>(10) { throw Exception() }
arrayOf<<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Nothing<!>>()
Array<<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Nothing<!>>(10) { throw Exception() }
}
fun <T> foo(): Array<T> = (object {} as Any) as Array<T>
@@ -5,12 +5,12 @@ 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 a = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>arrayOf<!>(null!!)
val b = Array<<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Nothing?<!>>(5) { null!! }
val c = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo<!>() { null!! }
val d = foo<Any> { null!! }
val e = foo { "1" as Nothing }
val e1 = foo { "1" as Nothing? }
val e = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo<!> { "1" as Nothing }
val e1 = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo<!> { "1" as Nothing? }
val f = javaClass<Nothing>()
val f = javaClass<<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Nothing<!>>()
}