JVM IR: slightly change field renaming convention implementation

Prefer to rename fields from the class, not from the companion, to be
more in line with the old backend's behavior. This has no effect on the
behavior of current tests but removes differences in metadata (since
metadata has information about every property->field mapping) in some of
them
This commit is contained in:
Alexander Udalov
2019-03-28 19:05:35 +01:00
parent 6cc293a0c5
commit e22594acde
3 changed files with 21 additions and 4 deletions
@@ -1,5 +1,8 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FULL_JDK
import java.lang.reflect.Modifier
class A {
val x = "outer"
@@ -19,5 +22,11 @@ fun box(): String {
if (A.x != "companion") return "Fail companion x"
if (A.y != "companion") return "Fail companion y"
if (!Modifier.isStatic(A::class.java.getDeclaredField("x").modifiers))
return "Fail: A.x should be static"
if (Modifier.isStatic(A::class.java.getDeclaredField("x$1").modifiers))
return "Fail: A.x$1 should not be static"
return "OK"
}