K1: report swallowed diagnostic about upper bound violation
#KT-55055 Fixed
This commit is contained in:
committed by
Space Team
parent
b148df15a9
commit
930237b60e
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
/upperBoundViolation.kt:9:9: error: upper bound violation for generic parameter `T` of `printGenericNumber`: String is not a subtype of Number
|
||||
printGenericNumber(this[0])
|
||||
^
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
// ISSUE: KT-55055
|
||||
// FIR_DUMP
|
||||
fun <T : Number> printGenericNumber(t: T) = println("Number is $t")
|
||||
|
||||
fun main() {
|
||||
buildList { // inferred into MutableList<String>
|
||||
add("Boom")
|
||||
printGenericNumber(this[0])
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
FILE: upperBoundViolation.fir.kt
|
||||
public final fun <T : R|kotlin/Number|> printGenericNumber(t: R|T|): R|kotlin/Unit| {
|
||||
^printGenericNumber R|kotlin/io/println|(<strcat>(String(Number is ), R|<local>/t|))
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|kotlin/collections/buildList|<R|kotlin/String|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String(Boom))
|
||||
R|/printGenericNumber|<R|kotlin/String|>(this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|Stub (chain inference): TypeVariable(E)|>|(Int(0)))
|
||||
}
|
||||
)
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
// ISSUE: KT-55055
|
||||
// FIR_DUMP
|
||||
fun <T : Number> printGenericNumber(t: T) = println("Number is $t")
|
||||
|
||||
fun main() {
|
||||
buildList { // inferred into MutableList<String>
|
||||
add("Boom")
|
||||
<!UPPER_BOUND_VIOLATION_IN_CONSTRAINT!>printGenericNumber(this[0])<!>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user