From 60c3e6442f141e34835b8d8908e1b5d07ffa4ccd Mon Sep 17 00:00:00 2001 From: Alexander Podkhalyuzin Date: Fri, 31 May 2019 11:41:03 +0200 Subject: [PATCH] Do not resolve import to get imported name --- .../jetbrains/kotlin/resolve/lazy/LazyImportScope.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt index 0fa3fa0937c..4f3b5fc6c98 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt @@ -115,10 +115,18 @@ open class LazyImportResolver( } val allNames: Set? by lazy(LazyThreadSafetyMode.PUBLICATION) { - indexedImports.imports.flatMapToNullable(THashSet()) { getImportScope(it).computeImportedNames() } + indexedImports.imports.flatMapToNullable(THashSet()) { + if (it.isAllUnder) getImportScope(it).computeImportedNames() + else listOf(it.importedName) + } } - fun definitelyDoesNotContainName(name: Name) = allNames?.let { name !in it } == true + fun definitelyDoesNotContainName(name: Name): Boolean { + return indexedImports.imports.find { + if (it.isAllUnder) getImportScope(it).definitelyDoesNotContainName(name) //todo: optimize... + else it.importedName == name + } != null + } fun recordLookup(name: Name, location: LookupLocation) { if (allNames == null) return