[K2] Properly serialize constant values

#KT-56190 Fixed
This commit is contained in:
Ivan Kylchik
2023-03-31 23:36:16 +02:00
committed by Space Team
parent ac480e2285
commit 8499891756
14 changed files with 135 additions and 44 deletions
@@ -1,5 +1,5 @@
// KT-56190 K2 does not emit const initializers
// MUTED_WHEN: K2
// `val b = a + 20` will not be serialized in K2
package test
enum class Weapon {
@@ -1,5 +1,3 @@
// KT-56190 K2 does not emit const initializers
// MUTED_WHEN: K2
package test
class ClassA {
@@ -18,7 +16,9 @@ class ClassA {
inner class classC {
val memberFromC: Int = 200
}
}
class E {
companion object {
val stat: Int = 250
@@ -26,7 +26,9 @@ class ClassA {
val memberFromD: Int = 275
}
}
}
class F {
object ObjA {
val memberFromObjA: Int = 300
}
@@ -1,13 +1,4 @@
class ClassA constructor() {
companion object {
val stat: Int = 250
class D constructor() {
val memberFromD: Int = 275
}
}
object ObjA {
val memberFromObjA: Int = 300
}
class classB constructor() {
fun memberFromB(): Int
class BC constructor() {
@@ -20,4 +11,17 @@
inner class classC constructor() {
val memberFromC: Int = 200
}
}
class E constructor() {
companion object {
val stat: Int = 250
class D constructor() {
val memberFromD: Int = 275
}
}
}
class F constructor() {
object ObjA {
val memberFromObjA: Int = 300
}
}
@@ -1,5 +1,3 @@
// KT-56190 K2 does not emit const initializers
// MUTED_WHEN: K2
package test
annotation class Anno(val value: String)