Fix for bug introduced in moveConflictUtils (never show warnings when moving to the same scope)
This commit is contained in:
+15
-11
@@ -71,9 +71,7 @@ import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
|||||||
import org.jetbrains.kotlin.renderer.ParameterNameRenderingPolicy
|
import org.jetbrains.kotlin.renderer.ParameterNameRenderingPolicy
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.getImportableDescriptor
|
import org.jetbrains.kotlin.resolve.descriptorUtil.*
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny
|
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isSubclassOf
|
|
||||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||||
import org.jetbrains.kotlin.resolve.lazy.descriptors.findPackageFragmentForFile
|
import org.jetbrains.kotlin.resolve.lazy.descriptors.findPackageFragmentForFile
|
||||||
@@ -599,9 +597,11 @@ class MoveConflictChecker(
|
|||||||
fun descrText(d: DeclarationDescriptor) = d.findPsi()?.text ?: "unknown"
|
fun descrText(d: DeclarationDescriptor) = d.findPsi()?.text ?: "unknown"
|
||||||
when (currentScopeDeclaration) {
|
when (currentScopeDeclaration) {
|
||||||
is PackageFragmentDescriptor -> {
|
is PackageFragmentDescriptor -> {
|
||||||
val packageDescriptor = currentScopeDeclaration
|
fun getPackage(decl: PackageFragmentDescriptor) = decl.containingDeclaration.getPackage(decl.fqName)
|
||||||
.containingDeclaration
|
val packageDescriptor = getPackage(currentScopeDeclaration)
|
||||||
.getPackage(currentScopeDeclaration.fqName)
|
if ((declaration.containingDeclaration)?.fqNameOrNull() == currentScopeDeclaration.fqNameOrNull()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
packageDescriptor
|
packageDescriptor
|
||||||
.memberScope
|
.memberScope
|
||||||
.getContributedDescriptors { it == declaration.name }
|
.getContributedDescriptors { it == declaration.name }
|
||||||
@@ -609,11 +609,15 @@ class MoveConflictChecker(
|
|||||||
.forEach { report(descrText(it), packageDescriptor.fqName.asString()) }
|
.forEach { report(descrText(it), packageDescriptor.fqName.asString()) }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
is ClassDescriptor -> currentScopeDeclaration
|
is ClassDescriptor -> {
|
||||||
.unsubstitutedMemberScope
|
if ((declaration.containingDeclaration)?.fqNameOrNull() != currentScopeDeclaration.fqNameOrNull()) {
|
||||||
.getContributedDescriptors { it == declaration.name }
|
currentScopeDeclaration
|
||||||
.filter { equivalent(it, declaration) }
|
.unsubstitutedMemberScope
|
||||||
.forEach { report(descrText(it), descrText(currentScopeDeclaration)) }
|
.getContributedDescriptors { it == declaration.name }
|
||||||
|
.filter { equivalent(it, declaration) }
|
||||||
|
.forEach { report(descrText(it), descrText(currentScopeDeclaration)) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
currentScopeDeclaration.containingDeclaration?.let { walkDeclarations(it, declaration, report) }
|
currentScopeDeclaration.containingDeclaration?.let { walkDeclarations(it, declaration, report) }
|
||||||
|
|||||||
Reference in New Issue
Block a user