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:
committed by
Space Team
parent
5b0cb5c9db
commit
40c4e865c7
-20
@@ -1,20 +0,0 @@
|
||||
// JSPECIFY_STATE: strict
|
||||
// FILE: Box.java
|
||||
|
||||
import org.jspecify.annotations.*;
|
||||
|
||||
@NullMarked
|
||||
public class Box<V extends @Nullable Object> {
|
||||
public static <V extends @Nullable Object> Box<V> make() {
|
||||
return new Box<>();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Util.java
|
||||
public final class Util {
|
||||
public Box<?> boxId(Box<?> box) { return box; }
|
||||
}
|
||||
|
||||
// FILE: a.kt
|
||||
fun foo(u: Util) =
|
||||
u.boxId(Box.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>make<!>())
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// JSPECIFY_STATE: strict
|
||||
// FILE: Box.java
|
||||
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
// JSPECIFY_STATE: strict
|
||||
// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode
|
||||
|
||||
// FILE: J1.java
|
||||
import org.jspecify.annotations.*;
|
||||
|
||||
@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
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// JSPECIFY_STATE: strict
|
||||
// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user