Skip to content

Commit

Permalink
Using new API
Browse files Browse the repository at this point in the history
(cherry picked from commit 395ba7d)
  • Loading branch information
valentinkip authored and Alefas committed Mar 20, 2020
1 parent a5ef38a commit bcdb934
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class KotlinSuggestedRefactoringAvailability(refactoringSupport: SuggestedRefact
{
override fun refineSignaturesWithResolve(state: SuggestedRefactoringState): SuggestedRefactoringState {
val newDeclaration = state.declaration as? KtCallableDeclaration ?: return state
val oldDeclaration = state.createRestoredDeclarationCopy(refactoringSupport) as KtCallableDeclaration
val oldDeclaration = state.restoredDeclarationCopy() as KtCallableDeclaration
oldDeclaration.containingKtFile.forcedModuleInfo = newDeclaration.getModuleInfo()

val descriptorWithOldSignature = oldDeclaration.resolveToDescriptorIfAny() as CallableDescriptor
Expand Down Expand Up @@ -68,20 +68,13 @@ class KotlinSuggestedRefactoringAvailability(refactoringSupport: SuggestedRefact
descriptorWithNewSignature.extensionReceiverParameter?.type
)

return state.copy(
oldSignature = Signature.create(
oldSignature.name,
oldReturnType,
oldParameters,
oldAdditionalData?.copy(receiverType = oldReceiverType)
)!!,
newSignature = Signature.create(
newSignature.name,
newReturnType,
newParameters,
newAdditionalData?.copy(receiverType = newReceiverType)
)!!
)
return state
.withOldSignature(
Signature.create(oldSignature.name, oldReturnType, oldParameters, oldAdditionalData?.copy(receiverType = oldReceiverType))!!
)
.withNewSignature(
Signature.create(newSignature.name, newReturnType, newParameters, newAdditionalData?.copy(receiverType = newReceiverType))!!
)
}

private fun refineType(
Expand Down

0 comments on commit bcdb934

Please sign in to comment.