Add a test where a local variable has the same name as a property

This commit is contained in:
pyos
2022-09-28 14:33:12 +02:00
committed by teamcity
parent 03bea0dbaa
commit 77c2601382
7 changed files with 89 additions and 0 deletions
@@ -0,0 +1,26 @@
class Box(var item: String?)
fun <T> take(it: T) {}
fun Box.test() {
val other = Box("")
myRun {
if (item != null) {
take<String>(<!SMARTCAST_IMPOSSIBLE!>item<!>)
other.item = null
take<String>(<!SMARTCAST_IMPOSSIBLE!>item<!>)
this.item = null
take<String>(<!TYPE_MISMATCH!>item<!>)
}
}
var item: String? = "OK"
myRun {
if (item != null) {
this.item = null
take<String>(<!DEBUG_INFO_SMARTCAST!>item<!>)
}
}
}
fun myRun(block: () -> Unit) {}