Files
kotlin-fork/compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/overridesJavaAnnotated.fir.kt
T
pyos 5fec9f34b1 FIR: revert a hack that allows overriding T!! with T
1. this should've been only done if the language feature for validating
    that is disabled;

 2. that feature probably won't matter by the time FIR is stable;

 3. it only worked because type enhancement of type arguments is broken
    anyway - a more correct hack would be to provide a custom
    ConeTypePreparator.
2021-09-06 13:11:01 +03:00

43 lines
1.0 KiB
Kotlin
Vendored

// !LANGUAGE: +DefinitelyNonNullableTypes +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
// FILE: A.java
import org.jetbrains.annotations.*;
public interface A<T> {
public T foo(T x) { return x; }
@NotNull
public T bar(@NotNull T x) {}
}
// FILE: main.kt
interface B<T1> : A<T1> {
override fun foo(x: T1): T1
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T1 & Any): T1 & Any
}
interface C<T2> : A<T2> {
override fun foo(x: T2 & Any): T2 & Any
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T2): T2
}
interface D : A<String?> {
override fun foo(x: String?): String?
override fun bar(x: String): String
}
interface E : A<String> {
override fun foo(x: String): String
override fun bar(x: String): String
}
interface F : A<String?> {
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: String): String
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String?): String?
}
interface G<T3 : Any> : A<T3> {
override fun foo(x: T3): T3
override fun bar(x: T3): T3
}