mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
KTIJ-31336 [kotlin] Revert temporary hacks from OptimizedImportsBuilder required for KTIJ-31070
This is basically a revert of d5c7dcca commit. Now, when KTIJ-30991 is fixed, the conflicts are properly analyzed, and we don't need the hacks from this commit at all. ^KTIJ-31336 Fixed (cherry picked from commit d545b059ea58cae513fe5861d9851062b470d8eb) IJ-CR-149236 GitOrigin-RevId: a82f036fe1a958c7e151abb5f66351b19b676897
This commit is contained in:
committed by
intellij-monorepo-bot
parent
94249cf315
commit
b58ee60847
+2
-18
@@ -114,11 +114,7 @@ internal class OptimizedImportsBuilder(
|
||||
symbols.asSequence()
|
||||
.filter { it is ClassLikeSymbolInfo }
|
||||
.mapNotNull { importSymbolWithMapping(it) }
|
||||
.filterTo(classNamesToCheck) {
|
||||
// TODO reconsider this after KTIJ-30991 is fixed
|
||||
//needExplicitImport(it)
|
||||
true
|
||||
}
|
||||
.filterTo(classNamesToCheck) { needExplicitImport(it) }
|
||||
|
||||
if (fqNames.all { needExplicitImport(it) }) {
|
||||
importsToGenerate.add(starImportPath)
|
||||
@@ -133,13 +129,7 @@ internal class OptimizedImportsBuilder(
|
||||
val foundClassifiers = hierarchicalScope.findClassifiers(fqName.shortName()).firstOrNull()
|
||||
val singleFoundClassifier = foundClassifiers?.singleOrNull()
|
||||
|
||||
|
||||
val singleFoundClassifierFqName = singleFoundClassifier?.let {
|
||||
// TODO reconsider this after KTIJ-30991 is fixed
|
||||
importSymbolWithMapping(it)
|
||||
}
|
||||
|
||||
if (singleFoundClassifierFqName != fqName) {
|
||||
if (singleFoundClassifier?.importableFqName != fqName) {
|
||||
// add explicit import if failed to import with * (or from current package)
|
||||
importsToGenerate.add(ImportPath(fqName, false))
|
||||
|
||||
@@ -255,12 +245,6 @@ internal class OptimizedImportsBuilder(
|
||||
return findCorrespondingKotlinFqName(importableName) ?: importableName
|
||||
}
|
||||
|
||||
private fun KaSession.importSymbolWithMapping(symbol: KaClassifierSymbol): FqName? {
|
||||
val importableName = symbol.importableFqName ?: return null
|
||||
|
||||
return findCorrespondingKotlinFqName(importableName) ?: importableName
|
||||
}
|
||||
|
||||
private fun KaSession.canUseStarImport(importableSymbol: SymbolInfo, fqName: FqName): Boolean = when {
|
||||
fqName.parent().isRoot -> false
|
||||
// star import from objects is not allowed
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// NAME_COUNT_TO_USE_STAR_IMPORT: 2
|
||||
// IGNORE_K2
|
||||
package test
|
||||
|
||||
@Throws
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// NAME_COUNT_TO_USE_STAR_IMPORT: 2
|
||||
// IGNORE_K2
|
||||
package test
|
||||
|
||||
@Throws
|
||||
|
||||
Reference in New Issue
Block a user