Skip to content

Commit

Permalink
Minor changes after code review
Browse files Browse the repository at this point in the history
(cherry picked from commit 12bf8a4)
  • Loading branch information
valentinkip authored and Alefas committed Mar 20, 2020
1 parent 1c7a952 commit a5ef38a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.psi.psiUtil.hasBody
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.isError
import kotlin.contracts.contract

class KotlinSuggestedRefactoringAvailability(refactoringSupport: SuggestedRefactoringSupport) :
SuggestedRefactoringAvailability(refactoringSupport)
Expand Down Expand Up @@ -51,6 +52,7 @@ class KotlinSuggestedRefactoringAvailability(refactoringSupport: SuggestedRefact
descriptorWithOldSignature.valueParameters[oldIndex].type,
descriptorWithNewSignature.valueParameters[newIndex].type
)
// oldType and newType may not be null because arguments of refineType call were all non-null
improvedOldParameterTypesById[id] = oldType!!
improvedNewParameterTypesById[id] = newType!!
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ class KotlinSuggestedRefactoringExecution(
KotlinTypeInfo(text = newSignature.type, isCovariant = true)
}

require(descriptorWithNewSignature.valueParameters.size == newSignature.parameters.size)
require(descriptorWithNewSignature.valueParameters.size == newSignature.parameters.size) {
"Number of parameters of newSignature is ${newSignature.parameters.size} and of the descriptor is ${descriptorWithNewSignature.valueParameters.size}"
}

val parameterTypeInfos = descriptorWithNewSignature.valueParameters.zip(newSignature.parameters)
.map { (parameterDescriptor, parameterData) ->
val type = parameterDescriptor.varargElementType ?: parameterDescriptor.type
Expand Down

0 comments on commit a5ef38a

Please sign in to comment.