From 29ee233bb9a156b5cbdb859122297bd948dd1e6b Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Mon, 13 Jul 2020 12:00:09 +0300 Subject: [PATCH] Remove repeating scopes collected by `buildCompletionContextForFunction` - This is certainly a bug, we would have to fix it later --- .../kotlin/idea/frontend/api/fir/scopes/KtFirScopeProvider.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)