Suppressed inserting of package import from ImportInsertHelperImpl

This commit is contained in:
Stanislav Erokhin
2015-09-16 22:10:25 +03:00
parent 1614de86d2
commit 81934b75c2
3 changed files with 8 additions and 9 deletions
@@ -1,7 +1,5 @@
import java.util
class SortedSet
fun test(set: SortedSet) {
val a = util.SortedSet<caret>
val a = java.util.SortedSet
}
@@ -1,4 +1,2 @@
import java.lang.reflect
val x : reflect.Array<caret>
val x : java.lang.reflect.Array
val y: Array<String>
@@ -121,9 +121,6 @@ public class ImportInsertHelperImpl(private val project: Project) : ImportInsert
val classifier = topLevelScope.getClassifier(name, NoLookupLocation.FROM_IDE)
if (classifier?.importableFqName == targetFqName) return ImportDescriptorResult.ALREADY_IMPORTED
}
is PackageViewDescriptor -> {
if (topLevelScope.getPackage(name)?.importableFqName == targetFqName) return ImportDescriptorResult.ALREADY_IMPORTED
}
is FunctionDescriptor -> {
val functions = topLevelScope.getFunctions(name, NoLookupLocation.FROM_IDE)
if (functions.map { it.importableFqName }.contains(targetFqName)) return ImportDescriptorResult.ALREADY_IMPORTED
@@ -132,6 +129,12 @@ public class ImportInsertHelperImpl(private val project: Project) : ImportInsert
val properties = topLevelScope.getProperties(name, NoLookupLocation.FROM_IDE)
if (properties.map { it.importableFqName }.contains(targetFqName)) return ImportDescriptorResult.ALREADY_IMPORTED
}
// todo change this after adding special syntax for package import
// now impossible import package
//
// is PackageViewDescriptor -> {
// if (topLevelScope.getPackage(name)?.importableFqName == targetFqName) return ImportDescriptorResult.ALREADY_IMPORTED
// }
else -> {
return ImportDescriptorResult.FAIL
}