FIR: enhance Java type parameter bounds

This also fixes handling of self-recursive types.

TODO: fix jspecify/{strict,warn}Mode/Captured.fir.kt
This commit is contained in:
pyos
2021-08-12 18:55:44 +02:00
committed by teamcityserver
parent e2a48d3945
commit 03304bce96
30 changed files with 222 additions and 382 deletions
@@ -13,13 +13,13 @@ public class ClassTypeParameterBound <T extends @NotNull String> {
}
// FILE: main.kt
fun main(x: ClassTypeParameterBound<String?>, y: ClassTypeParameterBound<String>, a: String?, b: String) {
val x2 = ClassTypeParameterBound<String?>()
fun main(x: ClassTypeParameterBound<<!UPPER_BOUND_VIOLATED!>String?<!>>, y: ClassTypeParameterBound<String>, a: String?, b: String) {
val x2 = ClassTypeParameterBound<<!UPPER_BOUND_VIOLATED!>String?<!>>()
val y2 = ClassTypeParameterBound<String>()
val x3 = ClassTypeParameterBound(a)
val x3 = ClassTypeParameterBound(<!ARGUMENT_TYPE_MISMATCH!>a<!>)
val y3 = ClassTypeParameterBound(b)
val x4: ClassTypeParameterBound<String?> = ClassTypeParameterBound()
val x4: ClassTypeParameterBound<<!UPPER_BOUND_VIOLATED!>String?<!>> = <!TYPE_MISMATCH!>ClassTypeParameterBound()<!>
val y4: ClassTypeParameterBound<String> = ClassTypeParameterBound()
}
@@ -13,13 +13,13 @@ public class ClassTypeParameterBoundWithWarnings <T extends @NotNull String> {
}
// FILE: main.kt
fun main(x: ClassTypeParameterBoundWithWarnings<String?>, y: ClassTypeParameterBoundWithWarnings<String>, a: String?, b: String) {
val x2 = ClassTypeParameterBoundWithWarnings<String?>()
fun main(x: ClassTypeParameterBoundWithWarnings<<!UPPER_BOUND_VIOLATED!>String?<!>>, y: ClassTypeParameterBoundWithWarnings<String>, a: String?, b: String) {
val x2 = ClassTypeParameterBoundWithWarnings<<!UPPER_BOUND_VIOLATED!>String?<!>>()
val y2 = ClassTypeParameterBoundWithWarnings<String>()
val x3 = ClassTypeParameterBoundWithWarnings(a)
val x3 = ClassTypeParameterBoundWithWarnings(<!ARGUMENT_TYPE_MISMATCH!>a<!>)
val y3 = ClassTypeParameterBoundWithWarnings(b)
val x4: ClassTypeParameterBoundWithWarnings<String?> = ClassTypeParameterBoundWithWarnings()
val x4: ClassTypeParameterBoundWithWarnings<<!UPPER_BOUND_VIOLATED!>String?<!>> = <!TYPE_MISMATCH!>ClassTypeParameterBoundWithWarnings()<!>
val y4: ClassTypeParameterBoundWithWarnings<String> = ClassTypeParameterBoundWithWarnings()
}
@@ -10,5 +10,5 @@ public interface MapLike<@org.jetbrains.annotations.NotNull K> {
// FILE: main.kt
fun test2(map : MapLike<Int>, x2: Int?) {
map.put(x2)
map.put(<!ARGUMENT_TYPE_MISMATCH!>x2<!>)
}