Make freshly substituted type variables def not nullable if they come from not null type parameter

^KT-48778 Fixed
This commit is contained in:
Victor Petukhov
2021-10-06 18:42:35 +03:00
parent 02d06b6390
commit 836c6b280d
12 changed files with 80 additions and 14 deletions
@@ -0,0 +1,14 @@
// FIR_IDENTICAL
// WITH_RUNTIME
// FILE: Java.java
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface Java<T extends @Nullable Object> {
@NonNull T getFoo();
}
// FILE: main.kt
fun usingMethod(java : Java<String?>) : String = java.getFoo()
fun usingProperty(java : Java<String?>) : String = java.foo
@@ -0,0 +1,11 @@
package
public fun usingMethod(/*0*/ java: Java<kotlin.String?>): kotlin.String
public fun usingProperty(/*0*/ java: Java<kotlin.String?>): kotlin.String
public interface Java</*0*/ T> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@org.checkerframework.checker.nullness.qual.NonNull public abstract fun getFoo(): @org.checkerframework.checker.nullness.qual.NonNull T
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}