mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
This commits introduces testdata changes, where NI behaviour strictly improved, after several previous fixes. For some tests, just WITH_NEW_INFERENCE directive was added. It indicates, that some of previous commits first introduced error in that test, and then some other commit fixed it (netting no overall testdata change). It is preferrably to keep those annotations until we will migrate to NI completely, to prevent unexpected regressions.
23 lines
816 B
Kotlin
Vendored
23 lines
816 B
Kotlin
Vendored
// !WITH_NEW_INFERENCE
|
|
class Data<T>(val x: T, val y: T)
|
|
|
|
operator fun <T> Data<T>.component1() = x
|
|
|
|
operator fun <T> Data<T>.component2() = y
|
|
|
|
fun foo(): Int {
|
|
val d: Data<Int>? = null
|
|
// An error must be here
|
|
val (x, y) = <!COMPONENT_FUNCTION_ON_NULLABLE, COMPONENT_FUNCTION_ON_NULLABLE!>d<!>
|
|
return <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>y<!>
|
|
}
|
|
|
|
data class NormalData<T>(val x: T, val y: T)
|
|
|
|
fun bar(): Int {
|
|
val d: NormalData<Int>? = null
|
|
// An error must be here
|
|
val (x, y) = <!COMPONENT_FUNCTION_ON_NULLABLE, COMPONENT_FUNCTION_ON_NULLABLE!>d<!>
|
|
return <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>y<!>
|
|
}
|