K2/Java/enhancement: implement wildcards replacement with flexible bounds

This commit in fact changes two very related places:
- first, it implements forgotten 'enhancedForWarnings' in K2 enhancement
- second, it repeats KT-48515 fix for K2 while enhancing wildcards

#KT-65594 Fixed
Related to KT-48515, KT-63746
This commit is contained in:
Mikhail Glukhikh
2024-03-14 12:23:43 +01:00
committed by Space Team
parent 5b0cb5c9db
commit 40c4e865c7
25 changed files with 62 additions and 399 deletions
@@ -1,18 +0,0 @@
// JSPECIFY_STATE: strict
// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode
// FILE: J1.java
import org.jspecify.nullness.*;
@NullMarked
public interface J1<T extends @Nullable Object> {
T foo();
}
// FILE: J2.java
public interface J2 {
J1<?> bar();
}
// FILE: main.kt
fun baz(j2: J2): Any = <!RETURN_TYPE_MISMATCH!>j2.bar().foo()<!> // Any..Any?
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// JSPECIFY_STATE: strict
// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode