bcc8802014
Expression will be checked against expected type later. Theoretically, this is not very good, but it aligns with the old inference, plus it helps avoiding multiple type mismatch diagnostics.
11 lines
280 B
Kotlin
Vendored
11 lines
280 B
Kotlin
Vendored
// !WITH_NEW_INFERENCE
|
|
|
|
fun foo(x: String): String? = x
|
|
|
|
fun calc(x: String?, y: Int?): Int {
|
|
// Smart cast because of x!! in receiver
|
|
foo(x!!)?.subSequence(y!!, <!DEBUG_INFO_SMARTCAST!>x<!>.length)?.length
|
|
// No smart cast possible
|
|
return <!TYPE_MISMATCH!>y<!>
|
|
}
|