[FIR] Support flexible and DNN types in upper bound violated extra message
#KT-66379 Fixed
This commit is contained in:
committed by
Space Team
parent
926ae2abb8
commit
09a19d7dbe
+1
-1
@@ -209,7 +209,7 @@ fun checkUpperBoundViolated(
|
|||||||
argumentSource, FirErrors.UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION, upperBound, argumentType.type, context
|
argumentSource, FirErrors.UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION, upperBound, argumentType.type, context
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
val extraMessage = if(upperBound is ConeCapturedType) "Consider removing the explicit type arguments" else ""
|
val extraMessage = if (upperBound.lowerBoundIfFlexible().originalIfDefinitelyNotNullable() is ConeCapturedType) "Consider removing the explicit type arguments" else ""
|
||||||
reporter.reportOn(
|
reporter.reportOn(
|
||||||
argumentSource, FirErrors.UPPER_BOUND_VIOLATED,
|
argumentSource, FirErrors.UPPER_BOUND_VIOLATED,
|
||||||
upperBound, argumentType.type, extraMessage, context
|
upperBound, argumentType.type, extraMessage, context
|
||||||
|
|||||||
Vendored
+7
-3
@@ -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.
|
||||||
|
|||||||
+20
-1
@@ -1,12 +1,31 @@
|
|||||||
// ISSUE: KT-65712
|
// ISSUE: KT-65712
|
||||||
// RENDER_DIAGNOSTICS_FULL_TEXT
|
// 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<List<*>, *><!>>()
|
||||||
a.value<<!UPPER_BOUND_VIOLATED!>BodySpec<*, *><!>>()
|
a.value<<!UPPER_BOUND_VIOLATED!>BodySpec<*, *><!>>()
|
||||||
a.value<<!UPPER_BOUND_VIOLATED!>BodySpec<Int, *><!>>()
|
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>> {
|
interface BodySpec<B, S : BodySpec<B, S>> {
|
||||||
fun <T : S> value(): T
|
fun <T : S> value(): T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface WithDnn<T : WithDnn<T>?> {
|
||||||
|
fun <K : T & Any> bar() {}
|
||||||
|
}
|
||||||
+20
-1
@@ -1,12 +1,31 @@
|
|||||||
// ISSUE: KT-65712
|
// ISSUE: KT-65712
|
||||||
// RENDER_DIAGNOSTICS_FULL_TEXT
|
// 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<List<*>, *>>()
|
||||||
a.value<BodySpec<*, *>>()
|
a.value<BodySpec<*, *>>()
|
||||||
a.value<BodySpec<Int, *>>()
|
a.value<BodySpec<Int, *>>()
|
||||||
|
a.value()
|
||||||
|
|
||||||
|
k.bar<WithDnn<*>>()
|
||||||
|
k.bar()
|
||||||
|
|
||||||
|
j.value<JavaClass<*,*>>()
|
||||||
|
j.value()
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BodySpec<B, S : BodySpec<B, S>> {
|
interface BodySpec<B, S : BodySpec<B, S>> {
|
||||||
fun <T : S> value(): T
|
fun <T : S> value(): T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface WithDnn<T : WithDnn<T>?> {
|
||||||
|
fun <K : T & Any> bar() {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user