[FIR2IR] Allow symbolTable cache lookups if IR f/o builder mode is enabled
Without this change, the following test is failing: - FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.Collections.testInheritFromHashtable ^KT-58861
This commit is contained in:
committed by
Space Team
parent
9a109e98ce
commit
0e92f98031
+23
-9
@@ -1018,15 +1018,29 @@ class Fir2IrDeclarationStorage(
|
|||||||
*/
|
*/
|
||||||
signatureCalculator()?.let { signature ->
|
signatureCalculator()?.let { signature ->
|
||||||
val cachedInSymbolTable = referenceIfAny(signature) ?: return@let
|
val cachedInSymbolTable = referenceIfAny(signature) ?: return@let
|
||||||
if (isFakeOverride) {
|
when {
|
||||||
val key = FakeOverrideIdentifier(
|
isFakeOverride -> {
|
||||||
declaration.symbol.unwrapFakeOverrides(),
|
val key = FakeOverrideIdentifier(
|
||||||
fakeOverrideOwnerLookupTag ?: declaration.containingClassLookupTag()!!
|
declaration.symbol.unwrapFakeOverrides(),
|
||||||
)
|
fakeOverrideOwnerLookupTag ?: declaration.containingClassLookupTag()!!
|
||||||
irFakeOverridesForFirFakeOverrideMap[key] = cachedInSymbolTable
|
)
|
||||||
return cachedInSymbolTable
|
irFakeOverridesForFirFakeOverrideMap[key] = cachedInSymbolTable
|
||||||
} else {
|
return cachedInSymbolTable
|
||||||
error("IR declaration with signature $signature found in SymbolTable and not found in declaration storage")
|
}
|
||||||
|
configuration.useIrFakeOverrideBuilder -> {
|
||||||
|
/*
|
||||||
|
* If IR fake override builder is used for building fake-overrides, they are generated bypassing Fir2IrDeclarationStorage,
|
||||||
|
* and are written directly to SymbolTable. So in this case it is normal to save the result from symbol table into
|
||||||
|
* storage
|
||||||
|
*
|
||||||
|
* TODO: potentially this situation won't happen after migration from FIR2IR f/o generator to IR f/o generator (see KT-58861)
|
||||||
|
*/
|
||||||
|
cache[declaration] = cachedInSymbolTable
|
||||||
|
return cachedInSymbolTable
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
error("IR declaration with signature $signature found in SymbolTable and not found in declaration storage")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user