Skip to content

Commit

Permalink
Using new API
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinkip committed Mar 18, 2020
1 parent 7a3f6f5 commit 395ba7d
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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 ?: return state
val oldDeclaration = state.restoredDeclarationCopy() as? KtCallableDeclaration ?: return state
oldDeclaration.containingKtFile.forcedModuleInfo = newDeclaration.getModuleInfo()

val descriptorWithOldSignature = oldDeclaration.resolveToDescriptorIfAny() as CallableDescriptor
Expand Down Expand Up @@ -67,20 +67,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 395ba7d

Please sign in to comment.