[NI] Don't loose diagnostic after type variable fixation

#KT-24488 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-08-19 01:51:04 +03:00
parent ca8da22569
commit e0fb586aaf
15 changed files with 77 additions and 22 deletions
@@ -59,13 +59,11 @@ fun testVariableWithBound() {
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.Int>")!>c1<!>
// should be an error after variable fixation
val c2 = select(SubInv<String>(), createWithNumberBound())
val c2 = <!TYPE_MISMATCH!>select<!>(SubInv<String>(), createWithNumberBound())
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.String>")!>c2<!>
// should be an error after variable fixation
val c3 = select(SubInv<Double>(), createWithIntBound())
val c3 = <!TYPE_MISMATCH!>select<!>(SubInv<Double>(), createWithIntBound())
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.Double>")!>c3<!>
}
@@ -78,13 +76,13 @@ fun testCapturedVariable() {
val c1 = select(SubInv<Number>(), createInvOut())
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.Number>")!>c1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<out kotlin.Number>")!>c1<!>
val c2 = select(createSubInvOut<Number>(), createInvOut())
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<out kotlin.Number>")!>c2<!>
val c3 = select(SubInv<Number>(), createInvIn())
val c3 = <!TYPE_MISMATCH!>select<!>(SubInv<Number>(), createInvIn())
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<out kotlin.Number>")!>c3<!>
}
@@ -2,4 +2,4 @@
fun <T : Any> nullable(): T? = null
val value = nullable<Int>() ?: <!OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>nullable()<!>
val value = nullable<Int>() <!NI;TYPE_MISMATCH!>?:<!> <!OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>nullable()<!>
@@ -11,13 +11,13 @@ fun <K> elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y
fun <T : Number> materialize(): T? = null
fun test(nullableSample: ISample, any: Any) {
<!DEBUG_INFO_EXPRESSION_TYPE("ISample?")!>elvisSimple(
<!DEBUG_INFO_EXPRESSION_TYPE("ISample")!><!TYPE_MISMATCH!>elvisSimple<!>(
nullableSample,
<!DEBUG_INFO_EXPRESSION_TYPE("{ISample & Number}?")!>materialize()<!>
)<!>
elvisSimple(
<!DEBUG_INFO_EXPRESSION_TYPE("ISample?")!>elvisSimple(nullableSample, materialize())<!>,
<!DEBUG_INFO_EXPRESSION_TYPE("ISample")!><!TYPE_MISMATCH!>elvisSimple<!>(nullableSample, materialize())<!>,
any
)