diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt index c20f7bc000b..296791d59bd 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt @@ -356,5 +356,5 @@ fun FqName.topLevelName() = asString().substringBefore(".") -private val JAVA_ENHANCEMENT = scopeSessionKey() -private val JAVA_USE_SITE = scopeSessionKey() +private val JAVA_ENHANCEMENT = scopeSessionKey() +private val JAVA_USE_SITE = scopeSessionKey() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt index 24491e9e0fa..00ba8b05901 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SupertypeUtils.kt @@ -38,25 +38,25 @@ fun lookupSuperTypes( } class ScopeSession { - private val scopes = hashMapOf, HashMap, FirScope>>() - fun getOrBuild(symbol: FirClassifierSymbol<*>, key: ScopeSessionKey, build: () -> T): T { - return scopes.getOrPut(symbol) { + private val scopes = hashMapOf, FirScope>>() + fun getOrBuild(id: ID, key: ScopeSessionKey, build: () -> FS): FS { + return scopes.getOrPut(id) { hashMapOf() }.getOrPut(key) { build() - } as T + } as FS } } -abstract class ScopeSessionKey() +abstract class ScopeSessionKey -inline fun scopeSessionKey(): ScopeSessionKey { - return object : ScopeSessionKey() {} +inline fun scopeSessionKey(): ScopeSessionKey { + return object : ScopeSessionKey() {} } -val USE_SITE = scopeSessionKey() +val USE_SITE = scopeSessionKey, FirScope>() -data class SubstitutionScopeKey(val type: ConeClassLikeType) : ScopeSessionKey() {} +data class SubstitutionScopeKey(val type: ConeClassLikeType) : ScopeSessionKey, FirClassSubstitutionScope>() {} fun FirClassSymbol<*>.buildUseSiteMemberScope(useSiteSession: FirSession, builder: ScopeSession): FirScope? { return when (this) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirIntegerLiteralTypeScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirIntegerLiteralTypeScope.kt index 59314261acb..052985dd2bc 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirIntegerLiteralTypeScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirIntegerLiteralTypeScope.kt @@ -76,7 +76,7 @@ class FirIntegerLiteralTypeScope(private val session: FirSession) : FirScope() { private val ALL_OPERATORS = FirIntegerOperator.Kind.values().map { it.operatorName to it }.toMap() val ILT_SYMBOL: FirClassifierSymbol<*> = FirIntegerLiteralTypeClassifierSymbol - val SCOPE_SESSION_KEY = scopeSessionKey() + val SCOPE_SESSION_KEY = scopeSessionKey, FirIntegerLiteralTypeScope>() } private val BINARY_OPERATOR_SYMBOLS = BINARY_OPERATOR_NAMES.map { name ->