Receiver smart casts: additional test for a?.b() when b is invokable property

This commit is contained in:
Mikhail Glukhikh
2016-07-25 10:39:30 +03:00
parent 692623cb55
commit 7c66f632ca
2 changed files with 30 additions and 0 deletions
@@ -121,4 +121,16 @@ fun falsePositive(w: Wrapper) {
// Here we should NOT have smart cast
<!SMARTCAST_IMPOSSIBLE!>w.unwrap()<!>.length
}
}
class Invokable(val x: String) {
operator fun invoke() = x
}
class InvokableProperty(val i: Invokable)
fun checkInvokable(ip: InvokableProperty?) {
if (ip?.<!UNSAFE_IMPLICIT_INVOKE_CALL!>i<!>() == "Hello") {
<!DEBUG_INFO_SMARTCAST!>ip<!>.hashCode()
}
}