FIR2IR: support static fake overrides for fields (related to KT-53441)
#KT-54921 Fixed
This commit is contained in:
committed by
Space Team
parent
6979271998
commit
c698d060c6
+3
-1
@@ -310,7 +310,9 @@ class FirClassSubstitutionScope(
|
||||
// TODO: do we have fields with implicit type?
|
||||
val newReturnType = returnType?.substitute() ?: return original
|
||||
|
||||
return FirFakeOverrideGenerator.createSubstitutionOverrideField(session, member, original, newReturnType, newOwnerClassId)
|
||||
return FirFakeOverrideGenerator.createSubstitutionOverrideField(
|
||||
session, member, original, newReturnType, newOwnerClassId, withInitializer = false
|
||||
)
|
||||
}
|
||||
|
||||
fun createSubstitutionOverrideSyntheticProperty(original: FirSyntheticPropertySymbol): FirSyntheticPropertySymbol {
|
||||
|
||||
+8
-1
@@ -487,7 +487,8 @@ object FirFakeOverrideGenerator {
|
||||
baseField: FirField,
|
||||
baseSymbol: FirFieldSymbol,
|
||||
newReturnType: ConeKotlinType?,
|
||||
derivedClassId: ClassId?
|
||||
derivedClassId: ClassId?,
|
||||
withInitializer: Boolean
|
||||
): FirFieldSymbol {
|
||||
val symbol = FirFieldSymbol(
|
||||
CallableId(derivedClassId ?: baseSymbol.callableId.classId!!, baseField.name)
|
||||
@@ -507,8 +508,14 @@ object FirFakeOverrideGenerator {
|
||||
annotations += baseField.annotations
|
||||
attributes = baseField.attributes.copy()
|
||||
dispatchReceiverType = baseField.dispatchReceiverType
|
||||
if (withInitializer) {
|
||||
initializer = baseField.initializer
|
||||
}
|
||||
}.apply {
|
||||
originalForSubstitutionOverrideAttr = baseField
|
||||
if (isStatic && derivedClassId != null) {
|
||||
containingClassForStaticMemberAttr = ConeClassLikeLookupTagImpl(derivedClassId)
|
||||
}
|
||||
}
|
||||
return symbol
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user