Files
kotlin/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/nullableReceiverWithOverloadedMethod.kt
Mikhail Zarechenskiy cd1ae7f0f2 Add resolution status to report about unsuccessful smartcast
#KT-10248 Fixed
 #KT-11119 Fixed
2017-06-22 13:41:27 +03:00

29 lines
510 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
fun f(x: Boolean): Int = 0
fun f(y: String): Int = 0
}
class B {
private var a: A? = null
fun takeInt(i: Int) {}
fun f() {
a = A()
<!SMARTCAST_IMPOSSIBLE!>a<!>.f(true)
takeInt(<!SMARTCAST_IMPOSSIBLE!>a<!>.f(""))
a.<!NONE_APPLICABLE!>f<!>()
}
fun g() {
takeInt(if (3 > 2) {
a = A()
<!SMARTCAST_IMPOSSIBLE!>a<!>.f(true)
} else {
6
})
}
}