diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirScopeProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirScopeProvider.kt index 4634b872f4d..c50734bbf4b 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirScopeProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/scopes/KtFirScopeProvider.kt @@ -93,11 +93,11 @@ internal class KtFirScopeProvider( val towerDataContext = completionContext.getTowerDataContext(positionInFakeFile) - val implicitReceivers = towerDataContext.nonLocalTowerDataElements.mapNotNull { it.implicitReceiver } + val implicitReceivers = towerDataContext.nonLocalTowerDataElements.mapNotNull { it.implicitReceiver }.distinct() val implicitReceiversTypes = implicitReceivers.map { builder.buildKtType(it.type) } val implicitReceiverScopes = implicitReceivers.mapNotNull { it.implicitScope } - val nonLocalScopes = towerDataContext.nonLocalTowerDataElements.mapNotNull { it.scope } + val nonLocalScopes = towerDataContext.nonLocalTowerDataElements.mapNotNull { it.scope }.distinct() val firLocalScopes = towerDataContext.localScopes @OptIn(ExperimentalStdlibApi::class)