Using new API
This commit is contained in:
+8
-15
@@ -22,7 +22,7 @@ class KotlinSuggestedRefactoringAvailability(refactoringSupport: SuggestedRefact
|
|||||||
{
|
{
|
||||||
override fun refineSignaturesWithResolve(state: SuggestedRefactoringState): SuggestedRefactoringState {
|
override fun refineSignaturesWithResolve(state: SuggestedRefactoringState): SuggestedRefactoringState {
|
||||||
val newDeclaration = state.declaration as? KtCallableDeclaration ?: return state
|
val newDeclaration = state.declaration as? KtCallableDeclaration ?: return state
|
||||||
val oldDeclaration = state.createRestoredDeclarationCopy(refactoringSupport) as? KtCallableDeclaration ?: return state
|
val oldDeclaration = state.restoredDeclarationCopy() as? KtCallableDeclaration ?: return state
|
||||||
oldDeclaration.containingKtFile.forcedModuleInfo = newDeclaration.getModuleInfo()
|
oldDeclaration.containingKtFile.forcedModuleInfo = newDeclaration.getModuleInfo()
|
||||||
|
|
||||||
val descriptorWithOldSignature = oldDeclaration.resolveToDescriptorIfAny() as CallableDescriptor
|
val descriptorWithOldSignature = oldDeclaration.resolveToDescriptorIfAny() as CallableDescriptor
|
||||||
@@ -67,20 +67,13 @@ class KotlinSuggestedRefactoringAvailability(refactoringSupport: SuggestedRefact
|
|||||||
descriptorWithNewSignature.extensionReceiverParameter?.type
|
descriptorWithNewSignature.extensionReceiverParameter?.type
|
||||||
)
|
)
|
||||||
|
|
||||||
return state.copy(
|
return state
|
||||||
oldSignature = Signature.create(
|
.withOldSignature(
|
||||||
oldSignature.name,
|
Signature.create(oldSignature.name, oldReturnType, oldParameters, oldAdditionalData?.copy(receiverType = oldReceiverType))!!
|
||||||
oldReturnType,
|
)
|
||||||
oldParameters,
|
.withNewSignature(
|
||||||
oldAdditionalData?.copy(receiverType = oldReceiverType)
|
Signature.create(newSignature.name, newReturnType, newParameters, newAdditionalData?.copy(receiverType = newReceiverType))!!
|
||||||
)!!,
|
)
|
||||||
newSignature = Signature.create(
|
|
||||||
newSignature.name,
|
|
||||||
newReturnType,
|
|
||||||
newParameters,
|
|
||||||
newAdditionalData?.copy(receiverType = newReceiverType)
|
|
||||||
)!!
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun refineType(
|
private fun refineType(
|
||||||
|
|||||||
Reference in New Issue
Block a user