Fix KotlinType.isNullabilityFlexible for types based on type parameters

In the compiler, this function was used in psi2ir (and it affected
nullability annotations in the resulting JVM class files), in "useless
elvis with null on the right side" diagnostic checker, and in light
classes.

 #KT-42650 Fixed
This commit is contained in:
Alexander Udalov
2020-10-13 21:56:04 +02:00
parent fbf56c054b
commit 45a0850d95
18 changed files with 97 additions and 63 deletions
@@ -24,6 +24,12 @@ public class JJJ {
public static JJJ staticNNN;
}
// FILE: JJJJ.java
public interface JJJJ<R> {
R get();
}
// FILE: k.kt
fun test() {
@@ -37,3 +43,5 @@ fun test() {
fun foo(a: Any?) {
}
fun <R> test2(j: JJJJ<R>) = j.get() ?: null
@@ -24,6 +24,12 @@ public class JJJ {
public static JJJ staticNNN;
}
// FILE: JJJJ.java
public interface JJJJ<R> {
R get();
}
// FILE: k.kt
fun test() {
@@ -37,3 +43,5 @@ fun test() {
fun foo(a: Any?) {
}
fun <R> test2(j: JJJJ<R>) = j.get() ?: null
@@ -2,6 +2,7 @@ package
public fun foo(/*0*/ a: kotlin.Any?): kotlin.Unit
public fun test(): kotlin.Unit
public fun </*0*/ R> test2(/*0*/ j: JJJJ<R>): R?
public open class J {
public constructor J()
@@ -32,3 +33,10 @@ public open class JJJ {
// Static members
@org.jetbrains.annotations.NotNull public final var staticNNN: JJJ
}
public interface JJJJ</*0*/ R : kotlin.Any!> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract fun get(): R!
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}