[FIR] Store matched actual class members inside FIR attribute

Currently, there is only attribute `ExpectForActualAttributeKey`
where mapping is stored only for source declarations with `actual`
modifier. But we need mapping of all class members, including classes
which were actualized via `actual typealias` or fake override members.
This data will be needed for the annotation checker in subsequent
commits.

^KT-60668
^KT-60936
This commit is contained in:
Roman Efremov
2023-08-04 11:33:43 +02:00
committed by Space Team
parent 2f00ed3ed7
commit 8aa3ccd342
25 changed files with 223 additions and 16 deletions
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.declarations
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility
@@ -31,3 +32,13 @@ val FirBasedSymbol<*>.expectForActual: ExpectForActualData?
return fir.expectForActual
}
private object MemberExpectForActualAttributeKey : FirDeclarationDataKey()
// Expect class in the key is needed, because class may correspond to two expects
// in case when two `actual typealias` point to the same class.
typealias MemberExpectForActualData =
Map<Pair</* actual member */ FirBasedSymbol<*>, /* expect class */ FirRegularClassSymbol>,
Map</* expect member */ FirBasedSymbol<*>, ExpectActualCompatibility<*>>>
var FirRegularClass.memberExpectForActual: MemberExpectForActualData? by FirDeclarationDataRegistry.data(MemberExpectForActualAttributeKey)