From f9b2929bca15d76a748f690f8121a3b3a8704b47 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 21 Dec 2016 22:27:20 +0300 Subject: [PATCH] KT-15154 IllegalStateException on attempt to convert import statement to * if last added import is to typealias #KT-15154 fixed --- .../org/jetbrains/kotlin/idea/util/ImportInsertHelperImpl.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/util/ImportInsertHelperImpl.kt b/idea/src/org/jetbrains/kotlin/idea/util/ImportInsertHelperImpl.kt index 3946dc08c47..33a44049dfb 100644 --- a/idea/src/org/jetbrains/kotlin/idea/util/ImportInsertHelperImpl.kt +++ b/idea/src/org/jetbrains/kotlin/idea/util/ImportInsertHelperImpl.kt @@ -94,7 +94,7 @@ class ImportInsertHelperImpl(private val project: Project) : ImportInsertHelper( private fun isAlreadyImported(target: DeclarationDescriptor, topLevelScope: LexicalScope, targetFqName: FqName): Boolean { val name = target.name return when (target) { - is ClassDescriptor -> { + is ClassifierDescriptorWithTypeParameters -> { val classifier = topLevelScope.findClassifier(name, NoLookupLocation.FROM_IDE) classifier?.importableFqName == targetFqName } @@ -144,7 +144,7 @@ class ImportInsertHelperImpl(private val project: Project) : ImportInsertHelper( && when (target) { // this check does not give a guarantee that import with * will import the class - for example, // there can be classes with conflicting name in more than one import with * - is ClassDescriptor -> topLevelScope.findClassifier(name, NoLookupLocation.FROM_IDE) == null + is ClassifierDescriptorWithTypeParameters -> topLevelScope.findClassifier(name, NoLookupLocation.FROM_IDE) == null is FunctionDescriptor, is PropertyDescriptor -> true else -> error("Unknown kind of descriptor to import:$target") }