Rename: Implement Rename conflict analysis for properties. Qualify property references to resove rename conflicts when possible
#KT-8732 Fixed #KT-12543 Fixed (cherry picked from commit e23029d)
This commit is contained in:
@@ -459,3 +459,8 @@ fun KtElement.nonStaticOuterClasses(): Sequence<KtClass> {
|
||||
}
|
||||
|
||||
fun KtElement.containingClass(): KtClass? = getStrictParentOfType<KtClass>()
|
||||
|
||||
fun KtClassOrObject.findPropertyByName(name: String): KtNamedDeclaration? {
|
||||
return declarations.firstOrNull { it is KtProperty && it.name == name } as KtNamedDeclaration?
|
||||
?: getPrimaryConstructorParameters().firstOrNull { it.hasValOrVar() && it.name == name }
|
||||
}
|
||||
@@ -69,13 +69,13 @@ fun ResolvedCall<*>.getExplicitReceiverValue(): ReceiverValue? {
|
||||
}
|
||||
}
|
||||
|
||||
fun ResolvedCall<*>.getImplicitReceiverValue(): ReceiverValue? {
|
||||
fun ResolvedCall<*>.getImplicitReceiverValue(): ImplicitReceiver? {
|
||||
return when (explicitReceiverKind) {
|
||||
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER -> extensionReceiver ?: dispatchReceiver
|
||||
ExplicitReceiverKind.DISPATCH_RECEIVER -> extensionReceiver
|
||||
ExplicitReceiverKind.EXTENSION_RECEIVER -> dispatchReceiver
|
||||
else -> null
|
||||
}
|
||||
} as? ImplicitReceiver
|
||||
}
|
||||
|
||||
private fun ResolvedCall<*>.hasSafeNullableReceiver(context: CallResolutionContext<*>): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user