[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
@@ -24,9 +24,9 @@ fun <T> test(x: T) {
baz<Int, String?>(<!NULL_FOR_NONNULL_TYPE!>null<!>, null, ::foo)
baz<Int?, String>(null, <!NULL_FOR_NONNULL_TYPE!>null<!>, ::foo)
baz(null, "", ::foo)
baz(1, null, ::foo)
baz(null, null, ::foo)
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>baz<!>(null, "", ::foo)
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>baz<!>(1, null, ::foo)
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>baz<!>(null, null, ::foo)
val s3: Pair<Int, String?> = <!TYPE_MISMATCH, TYPE_MISMATCH!>bar(null, null, ::foo)<!>
val s4: Pair<Int?, String> = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>bar(null, null, ::foo)<!>
@@ -11,5 +11,5 @@ fun test1() {
val f2: Foo<in Nothing> = foo1 { it checkType { _<Nothing>() } }
val f3: Foo<out Int> = foo2 { it checkType { _<Int>() } }
val f4: Foo<in Nothing> = foo2 { it checkType { _<Nothing>() } }
}
val f4: Foo<in Nothing> = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo2<!> { it checkType { _<Nothing>() } }
}
@@ -22,7 +22,7 @@ fun test2() {
}
fun test3() {
takeReifiedUnbound(null)
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>takeReifiedUnbound<!>(null)
}
fun test4(): Bound = takeReifiedUnbound(null)
@@ -35,7 +35,7 @@ fun test5(): Bound? = select(
fun test6() {
select(
null,
materializeReified()
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>materializeReified<!>()
)
}
@@ -48,6 +48,6 @@ fun test7(): Bound? =
fun test8() {
select(
null,
materializeReifiedUnbound()
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>materializeReifiedUnbound<!>()
)
}
@@ -28,7 +28,7 @@ inline fun <reified T : In<T>> testIn(): T {
// Unexpected behaviour
inline fun <reified T : Out<T>> testOut(): T {
return try {
outBound()
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>outBound<!>()
} catch (ex: Exception) {
throw Exception()
}