From f8ee97672038838f839250823c57f9a4a0ba3a0c Mon Sep 17 00:00:00 2001 From: Pavel Kirpichenkov Date: Thu, 18 Jun 2020 18:05:11 +0300 Subject: [PATCH] Use union of all available descriptors in composite importing scope --- .../org/jetbrains/kotlin/resolve/scopes/Scopes.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/scopes/Scopes.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/scopes/Scopes.kt index 1fedfcfce58..23ad9246d1a 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/scopes/Scopes.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/scopes/Scopes.kt @@ -187,8 +187,9 @@ class CompositePrioritizedImportingScope( nameFilter: (Name) -> Boolean, changeNamesForAliased: Boolean ): Collection { - return primaryScope.getContributedDescriptors(kindFilter, nameFilter, changeNamesForAliased) - .ifEmpty { secondaryScope.getContributedDescriptors(kindFilter, nameFilter, changeNamesForAliased) } + return primaryScope.getContributedDescriptors(kindFilter, nameFilter, changeNamesForAliased).union( + secondaryScope.getContributedDescriptors(kindFilter, nameFilter, changeNamesForAliased) + ) } override fun computeImportedNames(): Set? { @@ -206,15 +207,14 @@ class CompositePrioritizedImportingScope( } override fun getContributedVariables(name: Name, location: LookupLocation): Collection { - return primaryScope.getContributedVariables(name, location).ifEmpty { + return primaryScope.getContributedVariables(name, location).union( secondaryScope.getContributedVariables(name, location) - } + ) } override fun getContributedFunctions(name: Name, location: LookupLocation): Collection { - return primaryScope.getContributedFunctions(name, location).ifEmpty { + return primaryScope.getContributedFunctions(name, location).union( secondaryScope.getContributedFunctions(name, location) - } + ) } - } \ No newline at end of file