Use more specific status to report diagnostics

#KT-12737 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2017-07-10 10:58:36 +03:00
parent 178bb900b4
commit e82c909f75
11 changed files with 69 additions and 14 deletions
@@ -71,7 +71,8 @@ enum class ResolutionCandidateApplicability {
MAY_THROW_RUNTIME_ERROR, // unsafe call or unstable smart cast
RUNTIME_ERROR, // problems with visibility
IMPOSSIBLE_TO_GENERATE, // access to outer class from nested
INAPPLICABLE, // arguments not matched
INAPPLICABLE, // arguments have wrong types
INAPPLICABLE_ARGUMENTS_MAPPING_ERROR, // arguments not mapped to parameters (i.e. different size of arguments and parameters)
INAPPLICABLE_WRONG_RECEIVER, // receiver not matched
HIDDEN, // removed from resolve
}
@@ -20,6 +20,11 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValueWithSmartCastInfo
private val INAPPLICABLE_STATUSES = setOf(
ResolutionCandidateApplicability.INAPPLICABLE,
ResolutionCandidateApplicability.INAPPLICABLE_ARGUMENTS_MAPPING_ERROR,
ResolutionCandidateApplicability.INAPPLICABLE_WRONG_RECEIVER)
val ResolutionCandidateApplicability.isSuccess: Boolean
get() = this <= ResolutionCandidateApplicability.RESOLVED_LOW_PRIORITY
@@ -30,7 +35,7 @@ val CandidateWithBoundDispatchReceiver.requiresExtensionReceiver: Boolean
get() = descriptor.extensionReceiverParameter != null
val ResolutionCandidateApplicability.isInapplicable: Boolean
get() = this == ResolutionCandidateApplicability.INAPPLICABLE || this == ResolutionCandidateApplicability.INAPPLICABLE_WRONG_RECEIVER
get() = this in INAPPLICABLE_STATUSES
internal class CandidateWithBoundDispatchReceiverImpl(
override val dispatchReceiver: ReceiverValueWithSmartCastInfo?,