[NI] Refactoring: rename method

This commit is contained in:
Mikhail Zarechenskiy
2018-03-20 12:20:57 +03:00
parent bf92280f52
commit bb4fb669a0
4 changed files with 5 additions and 5 deletions
@@ -86,7 +86,7 @@ class DelegatedPropertyInferenceSession(
} }
object InferenceSessionForExistingCandidates : InferenceSession { object InferenceSessionForExistingCandidates : InferenceSession {
override fun shouldFixTypeVariables(candidate: KotlinResolutionCandidate): Boolean { override fun shouldRunCompletion(candidate: KotlinResolutionCandidate): Boolean {
return !ErrorUtils.isError(candidate.resolvedCall.candidateDescriptor) return !ErrorUtils.isError(candidate.resolvedCall.candidateDescriptor)
} }
@@ -30,7 +30,7 @@ abstract class ManyCandidatesResolver<D : CallableDescriptor>(
abstract fun prepareForCompletion(commonSystem: NewConstraintSystem, resolvedCallsInfo: List<PSIPartialCallInfo>) abstract fun prepareForCompletion(commonSystem: NewConstraintSystem, resolvedCallsInfo: List<PSIPartialCallInfo>)
override fun shouldFixTypeVariables(candidate: KotlinResolutionCandidate): Boolean { override fun shouldRunCompletion(candidate: KotlinResolutionCandidate): Boolean {
return false return false
} }
@@ -13,14 +13,14 @@ import org.jetbrains.kotlin.resolve.calls.model.PartialCallResolutionResult
interface InferenceSession { interface InferenceSession {
companion object { companion object {
val default = object : InferenceSession { val default = object : InferenceSession {
override fun shouldFixTypeVariables(candidate: KotlinResolutionCandidate): Boolean = true override fun shouldRunCompletion(candidate: KotlinResolutionCandidate): Boolean = true
override fun addPartialCallInfo(callInfo: PartialCallInfo) {} override fun addPartialCallInfo(callInfo: PartialCallInfo) {}
override fun addErrorCallInfo(callInfo: ErrorCallInfo) {} override fun addErrorCallInfo(callInfo: ErrorCallInfo) {}
override fun currentConstraintSystem(): ConstraintStorage = ConstraintStorage.Empty override fun currentConstraintSystem(): ConstraintStorage = ConstraintStorage.Empty
} }
} }
fun shouldFixTypeVariables(candidate: KotlinResolutionCandidate): Boolean fun shouldRunCompletion(candidate: KotlinResolutionCandidate): Boolean
fun addPartialCallInfo(callInfo: PartialCallInfo) fun addPartialCallInfo(callInfo: PartialCallInfo)
fun addErrorCallInfo(callInfo: ErrorCallInfo) fun addErrorCallInfo(callInfo: ErrorCallInfo)
fun currentConstraintSystem(): ConstraintStorage fun currentConstraintSystem(): ConstraintStorage
@@ -38,7 +38,7 @@ class KotlinCallCompleter(
val candidate = prepareCandidateForCompletion(factory, candidates, resolutionCallbacks) val candidate = prepareCandidateForCompletion(factory, candidates, resolutionCallbacks)
val completionType = candidate.prepareForCompletion(expectedType, resolutionCallbacks) val completionType = candidate.prepareForCompletion(expectedType, resolutionCallbacks)
return if (resolutionCallbacks.inferenceSession.shouldFixTypeVariables(candidate)) return if (resolutionCallbacks.inferenceSession.shouldRunCompletion(candidate))
candidate.runCompletion(completionType, diagnosticHolder, resolutionCallbacks) candidate.runCompletion(completionType, diagnosticHolder, resolutionCallbacks)
else else
candidate.asCallResolutionResult(ConstraintSystemCompletionMode.PARTIAL, diagnosticHolder) candidate.asCallResolutionResult(ConstraintSystemCompletionMode.PARTIAL, diagnosticHolder)