diff --git a/compiler/testData/codegen/boxWithJava/properties/commonProperties/commonProperties.kt b/compiler/testData/codegen/boxWithJava/properties/commonProperties/commonProperties.kt index b2ea7cddc25..b8efdb806eb 100644 --- a/compiler/testData/codegen/boxWithJava/properties/commonProperties/commonProperties.kt +++ b/compiler/testData/codegen/boxWithJava/properties/commonProperties/commonProperties.kt @@ -4,9 +4,24 @@ open class A { open var isProp: Int = -1 } +class B : J() { + override val valProp: Int = super.valProp + 1 + override var varProp: Int + set(value) { + super.varProp = value + } + get() = super.varProp + 1 + + override var isProp: Int + set(value) { + super.isProp = value + } + get() = super.isProp + 1 +} + fun box(): String { val j = J() - val a: A = j + var a: A = j if (j.valProp != 123) return "fail 1" if (a.valProp != 123) return "fail 2" @@ -33,5 +48,33 @@ fun box(): String { if (j.isProp != 789) return "fail 9" if (a.isProp != 789) return "fail 10" + val b = B() + a = b + + if (b.valProp != 124) return "fail 11" + if (a.valProp != 124) return "fail 12" + + b.varProp = -1 + if (!b.okField) return "fail 13" + b.okField = false + + a.varProp = -1 + if (!b.okField) return "fail 14" + b.okField = false + + if (b.varProp != 457) return "fail 15" + if (a.varProp != 457) return "fail 16" + + b.isProp = -1 + if (!b.okField) return "fail 17" + b.okField = false + + a.isProp = -1 + if (!b.okField) return "fail 18" + b.okField = false + + if (b.isProp != 790) return "fail 19" + if (a.isProp != 790) return "fail 20" + return "OK" }