Introduce inapplicable wrong receiver status to improve diagnostics

#KT-10754 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2017-07-10 05:19:19 +03:00
parent 79ee8f452c
commit 178bb900b4
7 changed files with 34 additions and 8 deletions
@@ -72,8 +72,8 @@ enum class ResolutionCandidateApplicability {
RUNTIME_ERROR, // problems with visibility
IMPOSSIBLE_TO_GENERATE, // access to outer class from nested
INAPPLICABLE, // arguments not matched
INAPPLICABLE_WRONG_RECEIVER, // receiver not matched
HIDDEN, // removed from resolve
// todo wrong receiver
}
abstract class ResolutionDiagnostic(val candidateLevel: ResolutionCandidateApplicability)
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,9 @@ val CallableDescriptor.isSynthesized: Boolean
val CandidateWithBoundDispatchReceiver.requiresExtensionReceiver: Boolean
get() = descriptor.extensionReceiverParameter != null
val ResolutionCandidateApplicability.isInapplicable: Boolean
get() = this == ResolutionCandidateApplicability.INAPPLICABLE || this == ResolutionCandidateApplicability.INAPPLICABLE_WRONG_RECEIVER
internal class CandidateWithBoundDispatchReceiverImpl(
override val dispatchReceiver: ReceiverValueWithSmartCastInfo?,
override val descriptor: CallableDescriptor,