[FIR] Support flexible and DNN types in upper bound violated extra message

#KT-66379 Fixed
This commit is contained in:
Kirill Rakhman
2024-03-07 11:32:04 +01:00
committed by Space Team
parent 926ae2abb8
commit 09a19d7dbe
4 changed files with 48 additions and 6 deletions
@@ -1,5 +1,9 @@
/capturedUpperBound.fir.kt:(100,120): error: Type argument is not within its bounds: should be subtype of 'CapturedType(*)'. Consider removing the explicit type arguments.
/test.kt:(116,136): error: Type argument is not within its bounds: should be subtype of 'CapturedType(*)'. Consider removing the explicit type arguments.
/capturedUpperBound.fir.kt:(136,150): error: Type argument is not within its bounds: should be subtype of 'CapturedType(*)'. Consider removing the explicit type arguments.
/test.kt:(152,166): error: Type argument is not within its bounds: should be subtype of 'CapturedType(*)'. Consider removing the explicit type arguments.
/capturedUpperBound.fir.kt:(166,182): error: Type argument is not within its bounds: should be subtype of 'CapturedType(*)'. Consider removing the explicit type arguments.
/test.kt:(182,198): error: Type argument is not within its bounds: should be subtype of 'CapturedType(*)'. Consider removing the explicit type arguments.
/test.kt:(227,237): error: Type argument is not within its bounds: should be subtype of 'CapturedType(*) & Any'. Consider removing the explicit type arguments.
/test.kt:(266,280): error: Type argument is not within its bounds: should be subtype of 'CapturedType(*)!'. Consider removing the explicit type arguments.
@@ -1,12 +1,31 @@
// ISSUE: KT-65712
// RENDER_DIAGNOSTICS_FULL_TEXT
fun test(a: BodySpec<List<*>, *>) {
// FILE: JavaClass.java
public interface JavaClass<B, S extends JavaClass<B, S>> {
public default <T extends S> T value() {
return null;
}
}
// FILE: test.kt
fun test(a: BodySpec<List<*>, *>, k: WithDnn<*>, j: JavaClass<List<*>, *>) {
a.value<<!UPPER_BOUND_VIOLATED!>BodySpec<List<*>, *><!>>()
a.value<<!UPPER_BOUND_VIOLATED!>BodySpec<*, *><!>>()
a.value<<!UPPER_BOUND_VIOLATED!>BodySpec<Int, *><!>>()
a.value()
k.bar<<!UPPER_BOUND_VIOLATED!>WithDnn<*><!>>()
k.bar()
j.value<<!UPPER_BOUND_VIOLATED!>JavaClass<*,*><!>>()
j.value()
}
interface BodySpec<B, S : BodySpec<B, S>> {
fun <T : S> value(): T
}
interface WithDnn<T : WithDnn<T>?> {
fun <K : T & Any> bar() {}
}
@@ -1,12 +1,31 @@
// ISSUE: KT-65712
// RENDER_DIAGNOSTICS_FULL_TEXT
fun test(a: BodySpec<List<*>, *>) {
// FILE: JavaClass.java
public interface JavaClass<B, S extends JavaClass<B, S>> {
public default <T extends S> T value() {
return null;
}
}
// FILE: test.kt
fun test(a: BodySpec<List<*>, *>, k: WithDnn<*>, j: JavaClass<List<*>, *>) {
a.value<BodySpec<List<*>, *>>()
a.value<BodySpec<*, *>>()
a.value<BodySpec<Int, *>>()
a.value()
k.bar<WithDnn<*>>()
k.bar()
j.value<JavaClass<*,*>>()
j.value()
}
interface BodySpec<B, S : BodySpec<B, S>> {
fun <T : S> value(): T
}
interface WithDnn<T : WithDnn<T>?> {
fun <K : T & Any> bar() {}
}