PSI2IR KT-44855 propagate smart cast information for property values

This commit is contained in:
Dmitry Petrov
2021-07-29 15:30:07 +03:00
committed by teamcityserver
parent cdbd0eb932
commit ca5ebdc13c
12 changed files with 322 additions and 5 deletions
@@ -0,0 +1,38 @@
// IGNORE_BACKEND: JVM
// TARGET_BACKEND: JVM
// MODULE: lib
// FILE: test/Parent.java
package test;
public class Parent {
protected String qqq = "";
public String getQqq() {
return qqq;
}
}
// MODULE: main(lib)
// FILE: kt44855.kt
import test.Parent
open class Child(val x: Parent?) : Parent() {
inner class QQQ {
fun z() {
x as Child
val q = x.qqq
x.qqq = q + "OK"
}
}
}
fun box(): String {
val cc = Child(null)
val c = Child(cc)
val d = c.QQQ()
d.z()
return cc.qqq
}
@@ -0,0 +1,41 @@
// TARGET_BACKEND: JVM
// MODULE: lib
// FILE: test/Parent.java
package test;
public class Parent {
private String qqq = "";
protected void setQqq(String q) {
this.qqq = q;
}
public String getQqq() {
return qqq;
}
}
// MODULE: main(lib)
// FILE: kt44855.kt
import test.Parent
open class Child(val x: Parent?) : Parent() {
inner class QQQ {
fun z() {
x as Child
val q = x.qqq
x.qqq = q + "OK"
}
}
}
fun box(): String {
val cc = Child(null)
val c = Child(cc)
val d = c.QQQ()
d.z()
return cc.qqq
}