diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt index 9655578ddb1..ee8dfb4f50f 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.lazy import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.fir.backend.* +import org.jetbrains.kotlin.fir.containingClassLookupTag import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.utils.* import org.jetbrains.kotlin.fir.dispatchReceiverClassLookupTagOrNull @@ -187,23 +188,26 @@ class Fir2IrLazyClass( fun addDeclarationsFromScope(scope: FirContainingNamesAwareScope?) { if (scope == null) return for (name in scope.getCallableNames()) { - scope.processFunctionsByName(name) { symbol -> - if (symbol.isSubstitutionOrIntersectionOverride) return@processFunctionsByName - if (!shouldBuildStub(symbol.fir)) return@processFunctionsByName - if (symbol.isStatic || symbol.dispatchReceiverClassLookupTagOrNull() == ownerLookupTag) { - if (symbol.isAbstractMethodOfAny()) { - return@processFunctionsByName + scope.processFunctionsByName(name) l@{ symbol -> + when { + symbol.isSubstitutionOrIntersectionOverride -> {} + !shouldBuildStub(symbol.fir) -> {} + symbol.containingClassLookupTag() != ownerLookupTag -> {} + symbol.isAbstractMethodOfAny() -> {} + else -> { + result += declarationStorage.getOrCreateIrFunction(symbol.fir, this, origin) } - result += declarationStorage.getOrCreateIrFunction(symbol.fir, this, origin) } } - scope.processPropertiesByName(name) { symbol -> - if (symbol.isSubstitutionOrIntersectionOverride) return@processPropertiesByName - if (!shouldBuildStub(symbol.fir)) return@processPropertiesByName - if (symbol is FirPropertySymbol && (symbol.isStatic || symbol.dispatchReceiverClassLookupTagOrNull() == ownerLookupTag)) { - result.addIfNotNull( - declarationStorage.getOrCreateIrProperty(symbol.fir, this, origin) - ) + scope.processPropertiesByName(name) l@{ symbol -> + when { + symbol.isSubstitutionOrIntersectionOverride -> {} + !shouldBuildStub(symbol.fir) -> {} + symbol.containingClassLookupTag() != ownerLookupTag -> {} + symbol !is FirPropertySymbol -> {} + else -> { + result += declarationStorage.getOrCreateIrProperty(symbol.fir, this, origin) + } } } }