Revert "[K2/N] KT-56190 Serialize simple const property initializers"
This reverts commit 2ace8ba9bd.
This commit is contained in:
-4
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.fir.serialization
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
|
||||
import org.jetbrains.kotlin.fir.expressions.FirConstExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.serialization.constant.ConstantValue
|
||||
@@ -45,7 +44,4 @@ class FirAnnotationSerializer(private val session: FirSession, internal val stri
|
||||
FirAnnotationArgumentVisitorData(this@FirAnnotationSerializer, this)
|
||||
)
|
||||
}
|
||||
|
||||
fun valueProto(constExpression: FirConstExpression<*>): ProtoBuf.Annotation.Argument.Value.Builder? =
|
||||
constExpression.toConstantValue(session)?.let { valueProto(it) }
|
||||
}
|
||||
|
||||
+1
-4
@@ -373,15 +373,12 @@ class FirElementSerializer private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
val hasConstant = !property.isVar && property.initializer?.let {
|
||||
it is FirConstExpression<*> && it.value != null
|
||||
} ?: false
|
||||
val flags = Flags.getPropertyFlags(
|
||||
hasAnnotations,
|
||||
ProtoEnumFlags.visibility(normalizeVisibility(property)),
|
||||
ProtoEnumFlags.modality(modality),
|
||||
ProtoBuf.MemberKind.DECLARATION,
|
||||
property.isVar, hasGetter, hasSetter, hasConstant, property.isConst, property.isLateInit,
|
||||
property.isVar, hasGetter, hasSetter, property.isConst, property.isConst, property.isLateInit,
|
||||
property.isExternal, property.delegateFieldSymbol != null, property.isExpect
|
||||
)
|
||||
if (flags != builder.flags) {
|
||||
|
||||
-8
@@ -22,8 +22,6 @@ import org.jetbrains.kotlin.fir.serialization.FirElementAwareSerializableStringT
|
||||
import org.jetbrains.kotlin.fir.serialization.FirElementSerializer
|
||||
import org.jetbrains.kotlin.fir.serialization.FirKLibSerializerExtension
|
||||
import org.jetbrains.kotlin.fir.serialization.serializeSingleFirFile
|
||||
import org.jetbrains.kotlin.fir.expressions.FirConstExpression
|
||||
import org.jetbrains.kotlin.fir.serialization.*
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
@@ -33,11 +31,9 @@ import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf
|
||||
import org.jetbrains.kotlin.library.metadata.resolver.TopologicalLibraryOrder
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.deserialization.Flags
|
||||
import org.jetbrains.kotlin.metadata.serialization.MutableVersionRequirementTable
|
||||
import org.jetbrains.kotlin.psi
|
||||
import org.jetbrains.kotlin.utils.toMetadataVersion
|
||||
import org.jetbrains.kotlin.resolve.constants.NullValue
|
||||
|
||||
internal fun PhaseContext.firSerializer(
|
||||
input: Fir2IrOutput
|
||||
@@ -198,10 +194,6 @@ class FirNativeKLibSerializerExtension(
|
||||
property.setter?.nonSourceAnnotations(session)?.forEach {
|
||||
proto.addExtension(KlibMetadataProtoBuf.propertySetterAnnotation, annotationSerializer.serializeAnnotation(it))
|
||||
}
|
||||
if (Flags.HAS_CONSTANT.get(proto.flags))
|
||||
annotationSerializer.valueProto(property.initializer as FirConstExpression<*>)?.let { constBuilder ->
|
||||
proto.setExtension(KlibMetadataProtoBuf.compileTimeValue, constBuilder.build())
|
||||
}
|
||||
// TODO KT-56090 Serialize KDocString
|
||||
super.serializeProperty(property, proto, versionRequirementTable, childSerializer)
|
||||
}
|
||||
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
// KT-56190: the following properties miss their initializers: arrayConst, b, enumConst
|
||||
// KT-56190 K2 does not emit const initializers
|
||||
// MUTED_WHEN: K2
|
||||
// IGNORE_BACKEND_K2
|
||||
|
||||
package test
|
||||
|
||||
enum class Weapon {
|
||||
|
||||
+2
-4
@@ -1,3 +1,5 @@
|
||||
// KT-56190 K2 does not emit const initializers
|
||||
// MUTED_WHEN: K2
|
||||
package test
|
||||
|
||||
class ClassA {
|
||||
@@ -16,9 +18,7 @@ class ClassA {
|
||||
inner class classC {
|
||||
val memberFromC: Int = 200
|
||||
}
|
||||
}
|
||||
|
||||
class E {
|
||||
companion object {
|
||||
val stat: Int = 250
|
||||
|
||||
@@ -26,9 +26,7 @@ class E {
|
||||
val memberFromD: Int = 275
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class F {
|
||||
object ObjA {
|
||||
val memberFromObjA: Int = 300
|
||||
}
|
||||
|
||||
+9
-13
@@ -1,4 +1,13 @@
|
||||
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() {
|
||||
@@ -11,17 +20,4 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Vendored
+2
@@ -1,3 +1,5 @@
|
||||
// KT-56190 K2 does not emit const initializers
|
||||
// MUTED_WHEN: K2
|
||||
package test
|
||||
|
||||
annotation class Anno(val value: String)
|
||||
|
||||
Reference in New Issue
Block a user