Minor, move tests about Java field and Kotlin property

Because the `fieldRename` directory was originally about cases when
private fields are renamed because of clashes.
This commit is contained in:
Alexander Udalov
2023-02-08 23:32:00 +01:00
parent 4b1f739c89
commit 4ad594a3cd
38 changed files with 527 additions and 396 deletions
@@ -0,0 +1,37 @@
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
// FIR_STATUS: accesses companion property backing field statically and fails (does not work in K1/JVM too)
// FILE: Base.java
public class Base {
protected String TAG = "OK";
public String foo() {
return TAG;
}
}
// FILE: Sub.kt
class Sub : Base() {
companion object {
val TAG = "FAIL"
}
fun log() = TAG
fun logReference() = this::TAG.get()
fun logAssignment(): String {
TAG = "12"
if (foo() != "12") return "Error writing: ${foo()}"
return "OK"
}
}
fun box(): String {
if (Sub().log() != "OK") return Sub().log()
if (Sub().logReference() != "OK") return Sub().logReference()
return Sub().logAssignment()
}