diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractStarImportingScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractStarImportingScope.kt index e98995566d6..f8ef4da817a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractStarImportingScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractStarImportingScope.kt @@ -24,11 +24,17 @@ abstract class FirAbstractStarImportingScope( protected abstract val starImports: List + private val absentClassifierNames = mutableSetOf() + override fun processClassifiersByName( name: Name, position: FirPosition, processor: (FirClassifierSymbol<*>) -> Boolean ): Boolean { + if (starImports.isEmpty() || name in absentClassifierNames) { + return true + } + var empty = true for (import in starImports) { val relativeClassName = import.relativeClassName val classId = when { @@ -37,10 +43,14 @@ abstract class FirAbstractStarImportingScope( else -> ClassId(import.packageFqName, relativeClassName.child(name), false) } val symbol = provider.getClassLikeSymbolByFqName(classId) ?: continue + empty = false if (!processor(symbol)) { return false } } + if (empty) { + absentClassifierNames += name + } return true }