Add different black box tests around KT-52338
This commit is contained in:
committed by
Space Team
parent
f6bd4d5e15
commit
bf090cdc6d
+24
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// Field VS property: case "lateinit"
|
||||
|
||||
// FILE: BaseJava.java
|
||||
public class BaseJava {
|
||||
public String a = "FAIL";
|
||||
|
||||
public String fieldValue() {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Derived.kt
|
||||
class Derived : BaseJava() {
|
||||
lateinit var a: String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val d = Derived()
|
||||
d.a = "OK"
|
||||
if ((d as BaseJava).a == "OK") return "FAIL (accidental shadowed field access #1)"
|
||||
if (d.fieldValue() == "OK") return "FAIL (accidental shadowed field access #2)"
|
||||
return d.a
|
||||
}
|
||||
Reference in New Issue
Block a user