[FIR2IR] Introduce shortcut utilities for unsubstituted and declared scopes
This commit is contained in:
committed by
Space Team
parent
5355f0f705
commit
42dd29aade
@@ -39,8 +39,10 @@ import org.jetbrains.kotlin.fir.resolve.*
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirSimpleSyntheticPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.FirProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope
|
||||
import org.jetbrains.kotlin.fir.scopes.FirTypeScope
|
||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.declaredMemberScope
|
||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||
@@ -407,7 +409,7 @@ internal fun FirSimpleFunction.processOverriddenFunctionSymbols(
|
||||
containingClass: FirClass,
|
||||
processor: (FirNamedFunctionSymbol) -> Unit
|
||||
) {
|
||||
val scope = containingClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = true, memberRequiredPhase = null)
|
||||
val scope = containingClass.unsubstitutedScope()
|
||||
scope.processFunctionsByName(name) {}
|
||||
scope.processOverriddenFunctionsFromSuperClasses(symbol, containingClass) { overriddenSymbol ->
|
||||
if (!session.visibilityChecker.isVisibleForOverriding(
|
||||
@@ -483,7 +485,7 @@ internal fun FirProperty.processOverriddenPropertySymbols(
|
||||
containingClass: FirClass,
|
||||
processor: (FirPropertySymbol) -> Unit
|
||||
): List<IrPropertySymbol> {
|
||||
val scope = containingClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = true, memberRequiredPhase = null)
|
||||
val scope = containingClass.unsubstitutedScope()
|
||||
scope.processPropertiesByName(name) {}
|
||||
val overriddenSet = mutableSetOf<IrPropertySymbol>()
|
||||
scope.processOverriddenPropertiesFromSuperClasses(symbol, containingClass) { overriddenSymbol ->
|
||||
@@ -519,7 +521,7 @@ internal fun FirProperty.generateOverriddenPropertySymbols(containingClass: FirC
|
||||
context(Fir2IrComponents)
|
||||
@OptIn(IrSymbolInternals::class)
|
||||
internal fun FirProperty.generateOverriddenAccessorSymbols(containingClass: FirClass, isGetter: Boolean): List<IrSimpleFunctionSymbol> {
|
||||
val scope = containingClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = true, memberRequiredPhase = null)
|
||||
val scope = containingClass.unsubstitutedScope()
|
||||
scope.processPropertiesByName(name) {}
|
||||
val overriddenSet = mutableSetOf<IrSimpleFunctionSymbol>()
|
||||
val superClasses = containingClass.getSuperTypesAsIrClasses() ?: return emptyList()
|
||||
@@ -855,3 +857,23 @@ internal val FirValueParameter.varargElementType: ConeKotlinType?
|
||||
if (!isVararg) return null
|
||||
return returnTypeRef.coneType.arrayElementType()
|
||||
}
|
||||
|
||||
context(Fir2IrComponents)
|
||||
internal fun FirClassSymbol<*>.unsubstitutedScope(): FirTypeScope {
|
||||
return this.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = true, memberRequiredPhase = null)
|
||||
}
|
||||
|
||||
context(Fir2IrComponents)
|
||||
internal fun FirClass.unsubstitutedScope(): FirTypeScope {
|
||||
return symbol.unsubstitutedScope()
|
||||
}
|
||||
|
||||
context(Fir2IrComponents)
|
||||
internal fun FirClassSymbol<*>.declaredScope(): FirContainingNamesAwareScope {
|
||||
return this.declaredMemberScope(session, memberRequiredPhase = null)
|
||||
}
|
||||
|
||||
context(Fir2IrComponents)
|
||||
internal fun FirClass.declaredScope(): FirContainingNamesAwareScope {
|
||||
return symbol.declaredScope()
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.fir.backend
|
||||
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.getDeclaredConstructors
|
||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||
import org.jetbrains.kotlin.ir.declarations.IrConstructor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
@@ -85,12 +84,7 @@ class Fir2IrBuiltIns(
|
||||
val constructorSymbol = if (firSymbol == null) {
|
||||
owner.declarations.firstIsInstance<IrConstructor>().symbol
|
||||
} else {
|
||||
val firConstructorSymbol = firSymbol.unsubstitutedScope(
|
||||
session,
|
||||
scopeSession,
|
||||
withForcedTypeCalculator = true,
|
||||
memberRequiredPhase = null,
|
||||
).getDeclaredConstructors().singleOrNull() ?: return null
|
||||
val firConstructorSymbol = firSymbol.unsubstitutedScope().getDeclaredConstructors().singleOrNull() ?: return null
|
||||
|
||||
declarationStorage.getIrConstructorSymbol(firConstructorSymbol)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.fir.resolve.providers.firProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.toSymbol
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||
import org.jetbrains.kotlin.fir.symbols.Fir2IrClassSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.Fir2IrEnumEntrySymbol
|
||||
@@ -210,7 +209,7 @@ class Fir2IrClassifierStorage(
|
||||
}
|
||||
|
||||
private fun FirRegularClass.hasAbstractMembersInScope(): Boolean {
|
||||
val scope = unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false, memberRequiredPhase = null)
|
||||
val scope = unsubstitutedScope()
|
||||
val names = scope.getCallableNames()
|
||||
var hasAbstract = false
|
||||
for (name in names) {
|
||||
|
||||
+1
-2
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.fir.resolve.dfa.cfg.isLocalClassOrAnonymousObject
|
||||
import org.jetbrains.kotlin.fir.resolve.isKFunctionInvoke
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.firProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||
import org.jetbrains.kotlin.fir.symbols.*
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
@@ -225,7 +224,7 @@ class Fir2IrDeclarationStorage(
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
val scope = firClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false, memberRequiredPhase = null)
|
||||
val scope = firClass.unsubstitutedScope()
|
||||
scope.getCallableNames().forEach { callableName ->
|
||||
buildList {
|
||||
fakeOverrideGenerator.generateFakeOverridesForName(
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.fir.moduleData
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.*
|
||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||
@@ -133,14 +132,9 @@ class Fir2IrPluginContext(
|
||||
?.fullyExpandedClass(components.session)
|
||||
?: return emptyList()
|
||||
|
||||
expandedClass
|
||||
.unsubstitutedScope(
|
||||
components.session,
|
||||
components.scopeSession,
|
||||
withForcedTypeCalculator = true,
|
||||
memberRequiredPhase = null,
|
||||
)
|
||||
.getCallablesFromScope()
|
||||
with(components) {
|
||||
expandedClass.unsubstitutedScope().getCallablesFromScope()
|
||||
}
|
||||
} else {
|
||||
symbolProvider.getCallablesFromProvider()
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.classId
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
@@ -87,12 +86,7 @@ class FirIrProvider(val fir2IrComponents: Fir2IrComponents) : IrProvider {
|
||||
?: return null
|
||||
}
|
||||
val classId = firClass.classId
|
||||
val scope = firClass.unsubstitutedScope(
|
||||
fir2IrComponents.session,
|
||||
fir2IrComponents.scopeSession,
|
||||
withForcedTypeCalculator = true,
|
||||
memberRequiredPhase = null,
|
||||
)
|
||||
val scope = with(fir2IrComponents) { firClass.unsubstitutedScope() }
|
||||
|
||||
when (kind) {
|
||||
SymbolKind.CLASS_SYMBOL -> {
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.fir.descriptors.FirModuleDescriptor
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.getFunctions
|
||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||
@@ -78,9 +77,7 @@ class IrBuiltInsOverFir(
|
||||
|
||||
private fun findFirMemberFunctions(classId: ClassId, name: Name): List<FirNamedFunctionSymbol> {
|
||||
val klass = symbolProvider.getClassLikeSymbolByClassId(classId) as FirRegularClassSymbol
|
||||
val scope = klass.unsubstitutedScope(
|
||||
session, components.scopeSession, withForcedTypeCalculator = true, memberRequiredPhase = null
|
||||
)
|
||||
val scope = with(components) { klass.unsubstitutedScope() }
|
||||
return scope.getFunctions(name)
|
||||
}
|
||||
|
||||
|
||||
+12
-20
@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutorByMap
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.approximateDeclarationType
|
||||
import org.jetbrains.kotlin.fir.scopes.getDeclaredConstructors
|
||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
@@ -38,7 +37,7 @@ import org.jetbrains.kotlin.fir.types.builder.buildTypeProjectionWithVariance
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.UNDEFINED_PARAMETER_INDEX
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.name
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
@@ -53,7 +52,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
class CallAndReferenceGenerator(
|
||||
private val components: Fir2IrComponents,
|
||||
private val visitor: Fir2IrVisitor,
|
||||
private val conversionScope: Fir2IrConversionScope
|
||||
private val conversionScope: Fir2IrConversionScope,
|
||||
) : Fir2IrComponents by components {
|
||||
|
||||
private val adapterGenerator = AdapterGenerator(components, conversionScope)
|
||||
@@ -67,7 +66,7 @@ class CallAndReferenceGenerator(
|
||||
fun convertToIrCallableReference(
|
||||
callableReferenceAccess: FirCallableReferenceAccess,
|
||||
explicitReceiverExpression: IrExpression?,
|
||||
isDelegate: Boolean
|
||||
isDelegate: Boolean,
|
||||
): IrExpression {
|
||||
val type = approximateFunctionReferenceType(callableReferenceAccess.resolvedType).toIrType()
|
||||
|
||||
@@ -366,7 +365,7 @@ class CallAndReferenceGenerator(
|
||||
explicitReceiverExpression: IrExpression?,
|
||||
dynamicOperator: IrDynamicOperator? = null,
|
||||
variableAsFunctionMode: Boolean = false,
|
||||
noArguments: Boolean = false
|
||||
noArguments: Boolean = false,
|
||||
): IrExpression {
|
||||
try {
|
||||
injectGetValueCall(qualifiedAccess, qualifiedAccess.calleeReference)?.let { return it }
|
||||
@@ -721,12 +720,7 @@ class CallAndReferenceGenerator(
|
||||
// Fallback for FirReferencePlaceholderForResolvedAnnotations from jar
|
||||
val fir = coneType.lookupTag.toSymbol(session)?.fir as? FirClass
|
||||
var constructorSymbol: FirConstructorSymbol? = null
|
||||
fir?.unsubstitutedScope(
|
||||
session,
|
||||
scopeSession,
|
||||
withForcedTypeCalculator = true,
|
||||
memberRequiredPhase = null,
|
||||
)?.processDeclaredConstructors {
|
||||
fir?.unsubstitutedScope()?.processDeclaredConstructors {
|
||||
if (it.fir.isPrimary && constructorSymbol == null) {
|
||||
constructorSymbol = it
|
||||
}
|
||||
@@ -765,9 +759,7 @@ class CallAndReferenceGenerator(
|
||||
annotationTypeRef = this@toAnnotationCall.annotationTypeRef
|
||||
val symbol = annotationTypeRef.coneType.fullyExpandedType(session).toSymbol(session) as? FirRegularClassSymbol ?: return null
|
||||
|
||||
val constructorSymbol =
|
||||
symbol.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false, memberRequiredPhase = null)
|
||||
.getDeclaredConstructors().firstOrNull() ?: return null
|
||||
val constructorSymbol = symbol.unsubstitutedScope().getDeclaredConstructors().firstOrNull() ?: return null
|
||||
|
||||
val argumentToParameterToMapping = constructorSymbol.valueParameterSymbols.mapNotNull {
|
||||
val parameter = it.fir
|
||||
@@ -788,7 +780,7 @@ class CallAndReferenceGenerator(
|
||||
|
||||
internal fun convertToGetObject(
|
||||
qualifier: FirResolvedQualifier,
|
||||
callableReferenceAccess: FirCallableReferenceAccess?
|
||||
callableReferenceAccess: FirCallableReferenceAccess?,
|
||||
): IrExpression? {
|
||||
val classSymbol = (qualifier.resolvedType as? ConeClassLikeType)?.lookupTag?.toSymbol(session)
|
||||
|
||||
@@ -823,7 +815,7 @@ class CallAndReferenceGenerator(
|
||||
}
|
||||
|
||||
private fun extractArgumentsMapping(
|
||||
call: FirCall
|
||||
call: FirCall,
|
||||
): Triple<List<FirValueParameter>?, Map<FirExpression, FirValueParameter>?, ConeSubstitutor> {
|
||||
val calleeReference = when (call) {
|
||||
is FirFunctionCall -> call.calleeReference
|
||||
@@ -987,7 +979,7 @@ class CallAndReferenceGenerator(
|
||||
|
||||
private fun needArgumentReordering(
|
||||
parametersInActualOrder: Collection<FirValueParameter>,
|
||||
valueParameters: List<FirValueParameter>
|
||||
valueParameters: List<FirValueParameter>,
|
||||
): Boolean {
|
||||
var lastValueParameterIndex = UNDEFINED_PARAMETER_INDEX
|
||||
for (parameter in parametersInActualOrder) {
|
||||
@@ -1028,7 +1020,7 @@ class CallAndReferenceGenerator(
|
||||
|
||||
private fun IrExpression.applyAssigningArrayElementsToVarargInNamedForm(
|
||||
argument: FirExpression,
|
||||
parameter: FirValueParameter?
|
||||
parameter: FirValueParameter?,
|
||||
): IrExpression {
|
||||
if (this !is IrVarargImpl ||
|
||||
parameter?.isVararg != true ||
|
||||
@@ -1051,7 +1043,7 @@ class CallAndReferenceGenerator(
|
||||
|
||||
private fun IrExpression.applyImplicitIntegerCoercionIfNeeded(
|
||||
argument: FirExpression,
|
||||
parameter: FirValueParameter?
|
||||
parameter: FirValueParameter?,
|
||||
): IrExpression {
|
||||
if (!session.languageVersionSettings.supportsFeature(LanguageFeature.ImplicitSignedToUnsignedIntegerConversion)) return this
|
||||
|
||||
@@ -1291,7 +1283,7 @@ class CallAndReferenceGenerator(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
calleeReference: FirReference,
|
||||
type: IrType? = null
|
||||
type: IrType? = null,
|
||||
): IrErrorCallExpression {
|
||||
return IrErrorCallExpressionImpl(
|
||||
startOffset, endOffset, type ?: createErrorType(),
|
||||
|
||||
+5
-14
@@ -10,9 +10,9 @@ import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClassSymbol
|
||||
import org.jetbrains.kotlin.fir.backend.Fir2IrComponents
|
||||
import org.jetbrains.kotlin.fir.backend.FirMetadataSource
|
||||
import org.jetbrains.kotlin.fir.backend.*
|
||||
import org.jetbrains.kotlin.fir.backend.declareThisReceiverParameter
|
||||
import org.jetbrains.kotlin.fir.backend.unsubstitutedScope
|
||||
import org.jetbrains.kotlin.fir.containingClassLookupTag
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.classId
|
||||
@@ -21,8 +21,6 @@ import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
|
||||
import org.jetbrains.kotlin.fir.scopes.getFunctions
|
||||
import org.jetbrains.kotlin.fir.scopes.getProperties
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.declaredMemberScope
|
||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
@@ -125,9 +123,7 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) : Fir2IrCompon
|
||||
// scope of kotlin.Nothing is empty, so we need to search for `hashCode` in scope of kotlin.Any
|
||||
return getHashCodeFunction(session.builtinTypes.anyType.type.toRegularClassSymbol(session)!!.fir)
|
||||
}
|
||||
val scope = klass.symbol.unsubstitutedScope(
|
||||
session, scopeSession, withForcedTypeCalculator = false, memberRequiredPhase = null
|
||||
)
|
||||
val scope = klass.symbol.unsubstitutedScope()
|
||||
return scope.getFunctions(HASHCODE_NAME).first { symbol ->
|
||||
val function = symbol.fir
|
||||
function.valueParameters.isEmpty() && function.receiverParameter == null && function.contextReceivers.isEmpty()
|
||||
@@ -159,7 +155,7 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) : Fir2IrCompon
|
||||
}
|
||||
|
||||
override fun getHashCodeFunctionInfo(property: IrProperty): HashCodeFunctionInfo {
|
||||
val firProperty = klass.symbol.declaredMemberScope(session, memberRequiredPhase = null)
|
||||
val firProperty = klass.symbol.declaredScope()
|
||||
.getProperties(property.name)
|
||||
.first { (it as FirPropertySymbol).fromPrimaryConstructor } as FirPropertySymbol
|
||||
|
||||
@@ -257,12 +253,7 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) : Fir2IrCompon
|
||||
}
|
||||
|
||||
private fun calculateSyntheticFirFunctions(): Map<Name, FirSimpleFunction> {
|
||||
val scope = klass.unsubstitutedScope(
|
||||
components.session,
|
||||
components.scopeSession,
|
||||
withForcedTypeCalculator = true,
|
||||
memberRequiredPhase = null,
|
||||
)
|
||||
val scope = klass.unsubstitutedScope()
|
||||
val contributedSyntheticFunctions =
|
||||
buildMap<Name, FirSimpleFunction> {
|
||||
for (name in listOf(EQUALS, HASHCODE_NAME, TO_STRING)) {
|
||||
|
||||
+1
-6
@@ -85,12 +85,7 @@ class DelegatedMemberGenerator(private val components: Fir2IrComponents) : Fir2I
|
||||
|
||||
// Generate delegated members for [subClass]. The synthetic field [irField] has the super interface type.
|
||||
fun generate(irField: IrField, firField: FirField, firSubClass: FirClass, subClass: IrClass) {
|
||||
val subClassScope = firSubClass.unsubstitutedScope(
|
||||
session,
|
||||
scopeSession,
|
||||
withForcedTypeCalculator = false,
|
||||
memberRequiredPhase = null,
|
||||
)
|
||||
val subClassScope = firSubClass.unsubstitutedScope()
|
||||
|
||||
val delegateToScope = firField.initializer!!.resolvedType
|
||||
.fullyExpandedType(session)
|
||||
|
||||
+3
-13
@@ -61,12 +61,7 @@ class FakeOverrideGenerator(
|
||||
|
||||
private fun IrClass.getFakeOverrides(klass: FirClass, realDeclarations: Collection<FirDeclaration>): List<IrDeclaration> {
|
||||
val result = mutableListOf<IrDeclaration>()
|
||||
val useSiteMemberScope = klass.unsubstitutedScope(
|
||||
session,
|
||||
scopeSession,
|
||||
withForcedTypeCalculator = true,
|
||||
memberRequiredPhase = null,
|
||||
)
|
||||
val useSiteMemberScope = klass.unsubstitutedScope()
|
||||
|
||||
val superTypesCallableNames = useSiteMemberScope.getCallableNames()
|
||||
val realDeclarationSymbols = realDeclarations.mapTo(mutableSetOf(), FirDeclaration::symbol)
|
||||
@@ -82,12 +77,7 @@ class FakeOverrideGenerator(
|
||||
name: Name,
|
||||
firClass: FirClass
|
||||
): List<IrDeclaration> = buildList {
|
||||
val useSiteMemberScope = firClass.unsubstitutedScope(
|
||||
session,
|
||||
scopeSession,
|
||||
withForcedTypeCalculator = true,
|
||||
memberRequiredPhase = null,
|
||||
)
|
||||
val useSiteMemberScope = firClass.unsubstitutedScope()
|
||||
|
||||
generateFakeOverridesForName(
|
||||
irClass, useSiteMemberScope, name, firClass, this,
|
||||
@@ -220,7 +210,7 @@ class FakeOverrideGenerator(
|
||||
fakeOverride: IrSimpleFunction,
|
||||
originalSymbol: FirNamedFunctionSymbol,
|
||||
) {
|
||||
val scope = klass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = true, memberRequiredPhase = null)
|
||||
val scope = klass.unsubstitutedScope()
|
||||
val classLookupTag = klass.symbol.toLookupTag()
|
||||
val baseFirSymbolsForFakeOverride =
|
||||
if (originalSymbol.shouldHaveComputedBaseSymbolsForClass(classLookupTag)) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.fir.isNewPlaceForBodyGeneration
|
||||
import org.jetbrains.kotlin.fir.isSubstitutionOrIntersectionOverride
|
||||
import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope
|
||||
import org.jetbrains.kotlin.fir.scopes.processClassifiersByName
|
||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
@@ -155,7 +154,7 @@ class Fir2IrLazyClass(
|
||||
val result = mutableListOf<IrDeclaration>()
|
||||
// NB: it's necessary to take all callables from scope,
|
||||
// e.g. to avoid accessing un-enhanced Java declarations with FirJavaTypeRef etc. inside
|
||||
val scope = fir.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = true, memberRequiredPhase = null)
|
||||
val scope = fir.unsubstitutedScope()
|
||||
scope.processDeclaredConstructors {
|
||||
if (shouldBuildStub(it.fir)) {
|
||||
result += declarationStorage.getIrConstructorSymbol(it).owner
|
||||
|
||||
Reference in New Issue
Block a user