[FIR] Share enhancedSymbolStorage between common and platform sessions

This is needed for two reasons:
1. common and platform modules are analyzed in the same setup with same
   dependencies and configurations, so the results of the enhancement for
   any function will be completely identical. So by sharing enhanced
   symbol storage, we avoid recomputation enhanced functions and improve
   performance
2. There is a goal to have some unique key for IR declarations in FIR2IR.
   For regular declarations, the key is just Fir symbol, and for fake-overrides
   it is a pair of original symbol and fake override owners lookup tag.
   But for enhanced functions the symbol is not unique, because we create
   different symbols for the same enhanced function for different modules.
   So this change fixes this problem

^KT-60397 Fixed

This change doesn't affect any tests in the moment, because it's part of
  bigger refactoring of proper storing IR declarations during FIR2IR
  conversion (KT-61637)

Without this change, there are some test breaks in branch for KT-61637:
- FirPsiBlackBoxCodegenTestGenerated.Multiplatform.testStarImportOfExpectEnumWithActualTypeAlias
- FirPsiBlackBoxCodegenTestGenerated.Multiplatform.K2.DefaultArguments.testNestedEnumEntryValue
- FirPsiBlackBoxCodegenTestGenerated.Multiplatform.K2.Basic.testEnumEntryNameCall
This commit is contained in:
Dmitriy Novozhilov
2023-09-01 15:08:56 +03:00
committed by Space Team
parent f4289e1287
commit bb36beb364
6 changed files with 38 additions and 20 deletions
@@ -747,8 +747,8 @@ private class EnhancementSignatureParts(
get() = (this as ConeTypeParameterLookupTag).symbol.fir.origin is FirDeclarationOrigin.Java
}
class FirEnhancedSymbolsStorage(val session: FirSession) : FirSessionComponent {
private val cachesFactory = session.firCachesFactory
class FirEnhancedSymbolsStorage(private val cachesFactory: FirCachesFactory) : FirSessionComponent {
constructor(session: FirSession) : this(session.firCachesFactory)
val cacheByOwner: FirCache<FirRegularClassSymbol, EnhancementSymbolsCache, Nothing?> =
cachesFactory.createCache { _ -> EnhancementSymbolsCache(cachesFactory) }