Implicit receiver smart casts implementation and highlighting

This commit is contained in:
Mikhail Glukhikh
2015-11-09 15:18:37 +03:00
parent 03287d5d66
commit 811ba8110f
17 changed files with 175 additions and 8 deletions
@@ -0,0 +1,24 @@
open class A {
class B : A() {
val a = "FAIL"
}
fun foo(): String {
if (this is B) return <!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>a<!>
return "OK"
}
}
fun A?.bar() {
if (this != null) <!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>foo<!>()
}
fun A.gav() = if (this is A.B) <!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>a<!> else ""
class C {
fun A?.complex(): String {
if (this is A.B) return <!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>a<!>
else if (this != null) return <!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>foo<!>()
else return ""
}
}