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
@@ -1,8 +1,18 @@
// WITH_RUNTIME
// FILE: test.kt
import java.util.Collections
class PlatformTypes {
fun simplyPlatform() = Collections.singletonList("")[0]
fun bothNullable() = Collections.emptyList<String>() ?: null
fun bothNotNull() = Collections.emptyList<String>()!!
fun <R> generic(j: J<R>) = j.get()
}
// FILE: J.java
public interface J<R> {
R get();
}
@@ -1,8 +1,9 @@
@kotlin.Metadata
public final class PlatformTypes {
// source: 'platformTypes.kt'
// source: 'test.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method bothNotNull(): java.util.List
public final @org.jetbrains.annotations.Nullable method bothNullable(): java.util.List
public final method generic(@org.jetbrains.annotations.NotNull p0: J): java.lang.Object
public final method simplyPlatform(): java.lang.String
}