FIR2IR: add workaround for SymbolTable conflicts in property/field situation
Related to KT-57049
This commit is contained in:
committed by
Space Team
parent
6c5afa4b87
commit
dbdefe90a3
+29
-10
@@ -868,9 +868,15 @@ class Fir2IrDeclarationStorage(
|
|||||||
symbol = FirPropertySymbol(field.symbol.callableId)
|
symbol = FirPropertySymbol(field.symbol.callableId)
|
||||||
isLocal = false
|
isLocal = false
|
||||||
status = field.status
|
status = field.status
|
||||||
|
}.apply {
|
||||||
|
isStubPropertyForPureField = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private object IsStubPropertyForPureFieldKey : FirDeclarationDataKey()
|
||||||
|
|
||||||
|
private var FirProperty.isStubPropertyForPureField: Boolean? by FirDeclarationDataRegistry.data(IsStubPropertyForPureFieldKey)
|
||||||
|
|
||||||
fun createIrProperty(
|
fun createIrProperty(
|
||||||
property: FirProperty,
|
property: FirProperty,
|
||||||
irParent: IrDeclarationParent?,
|
irParent: IrDeclarationParent?,
|
||||||
@@ -1467,17 +1473,30 @@ class Fir2IrDeclarationStorage(
|
|||||||
): IrProperty {
|
): IrProperty {
|
||||||
val symbol = Fir2IrPropertySymbol(signature)
|
val symbol = Fir2IrPropertySymbol(signature)
|
||||||
val firPropertySymbol = fir.symbol
|
val firPropertySymbol = fir.symbol
|
||||||
|
|
||||||
|
fun create(startOffset: Int, endOffset: Int): Fir2IrLazyProperty {
|
||||||
|
val isFakeOverride =
|
||||||
|
fir.isSubstitutionOrIntersectionOverride &&
|
||||||
|
firPropertySymbol.dispatchReceiverClassLookupTagOrNull() !=
|
||||||
|
firPropertySymbol.originalForSubstitutionOverride?.dispatchReceiverClassLookupTagOrNull()
|
||||||
|
return Fir2IrLazyProperty(
|
||||||
|
components, startOffset, endOffset, declarationOrigin,
|
||||||
|
fir, (lazyParent as? Fir2IrLazyClass)?.fir, symbol, isFakeOverride
|
||||||
|
).apply {
|
||||||
|
this.parent = lazyParent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val irProperty = fir.convertWithOffsets { startOffset, endOffset ->
|
val irProperty = fir.convertWithOffsets { startOffset, endOffset ->
|
||||||
symbolTable.declareProperty(signature, { symbol }) {
|
if (fir.isStubPropertyForPureField == true) {
|
||||||
val isFakeOverride =
|
// Very special case when two similar properties can exist so conflicts in SymbolTable are possible.
|
||||||
fir.isSubstitutionOrIntersectionOverride &&
|
// See javaCloseFieldAndKotlinProperty.kt in BB tests
|
||||||
firPropertySymbol.dispatchReceiverClassLookupTagOrNull() !=
|
symbolTable.declarePropertyWithSignature(signature, symbol)
|
||||||
firPropertySymbol.originalForSubstitutionOverride?.dispatchReceiverClassLookupTagOrNull()
|
create(startOffset, endOffset)
|
||||||
Fir2IrLazyProperty(
|
symbol.owner
|
||||||
components, startOffset, endOffset, declarationOrigin,
|
} else {
|
||||||
fir, (lazyParent as? Fir2IrLazyClass)?.fir, symbol, isFakeOverride
|
symbolTable.declareProperty(signature, { symbol }) {
|
||||||
).apply {
|
create(startOffset, endOffset)
|
||||||
this.parent = lazyParent
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user