KT-15154 IllegalStateException on attempt to convert import statement to * if last added import is to typealias
#KT-15154 fixed
This commit is contained in:
committed by
Simon Ogorodnik
parent
6273ab5d43
commit
f9b2929bca
@@ -94,7 +94,7 @@ class ImportInsertHelperImpl(private val project: Project) : ImportInsertHelper(
|
|||||||
private fun isAlreadyImported(target: DeclarationDescriptor, topLevelScope: LexicalScope, targetFqName: FqName): Boolean {
|
private fun isAlreadyImported(target: DeclarationDescriptor, topLevelScope: LexicalScope, targetFqName: FqName): Boolean {
|
||||||
val name = target.name
|
val name = target.name
|
||||||
return when (target) {
|
return when (target) {
|
||||||
is ClassDescriptor -> {
|
is ClassifierDescriptorWithTypeParameters -> {
|
||||||
val classifier = topLevelScope.findClassifier(name, NoLookupLocation.FROM_IDE)
|
val classifier = topLevelScope.findClassifier(name, NoLookupLocation.FROM_IDE)
|
||||||
classifier?.importableFqName == targetFqName
|
classifier?.importableFqName == targetFqName
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ class ImportInsertHelperImpl(private val project: Project) : ImportInsertHelper(
|
|||||||
&& when (target) {
|
&& when (target) {
|
||||||
// this check does not give a guarantee that import with * will import the class - for example,
|
// 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 *
|
// 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
|
is FunctionDescriptor, is PropertyDescriptor -> true
|
||||||
else -> error("Unknown kind of descriptor to import:$target")
|
else -> error("Unknown kind of descriptor to import:$target")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user