CandidateApplicability: add K1/K2 prefixes when applicable

This commit is contained in:
Mikhail Glukhikh
2022-07-19 14:42:13 +02:00
committed by Space
parent 8e9e8302f7
commit 0611f3b8e7
10 changed files with 39 additions and 37 deletions
@@ -6,29 +6,31 @@
package org.jetbrains.kotlin.resolve.calls.tower
enum class CandidateApplicability {
RESOLVED_TO_SAM_WITH_VARARG, // migration warning up to 1.5 (when resolve to function with SAM conversion and array without spread as vararg)
HIDDEN, // removed from resolve
VISIBILITY_ERROR, // problems with visibility
UNSUPPORTED, // unsupported feature
K1_RESOLVED_TO_SAM_WITH_VARARG, // migration warning up to 1.5 (when resolve to function with SAM conversion and array without spread as vararg)
HIDDEN, // removed from resolve (should get UNRESOLVED_REFERENCE, used for HIDDEN deprecations and similar things)
K2_VISIBILITY_ERROR, // problems with visibility (should get INVISIBLE_REFERENCE)
K2_UNSUPPORTED, // unsupported feature
INAPPLICABLE_WRONG_RECEIVER, // receiver not matched
INAPPLICABLE_ARGUMENTS_MAPPING_ERROR, // arguments not mapped to parameters (i.e. different size of arguments and parameters)
INAPPLICABLE, // arguments have wrong types
NO_COMPANION_OBJECT, // Classifier does not have a companion object
IMPOSSIBLE_TO_GENERATE, // access to outer class from nested
RUNTIME_ERROR, // TODO: FE 1.0 uses this as catch-all for all other errors. Consider re-assigning those diagnostics.
K2_NO_COMPANION_OBJECT, // Classifier does not have a companion object
K1_IMPOSSIBLE_TO_GENERATE, // access to outer class from nested
K1_RUNTIME_ERROR, // TODO: FE 1.0 uses this as catch-all for all other errors. Consider re-assigning those diagnostics.
UNSAFE_CALL, // receiver or argument nullability doesn't match
UNSTABLE_SMARTCAST, // unstable smart cast
CONVENTION_ERROR, // missing infix, operator etc (= no expected modifier)
// Below has shouldStopResolve = true
DSL_SCOPE_VIOLATION, // Skip other levels for DSL_SCOPE_VIOLATION because if the candidate is marked DSL_SCOPE_VIOLATION with an inner receiver, one should not keep going to outer receivers.
K2_DSL_SCOPE_VIOLATION, // Skip other levels for DSL_SCOPE_VIOLATION because if the candidate is marked DSL_SCOPE_VIOLATION with an inner receiver, one should not keep going to outer receivers.
// Below has isSuccess = true
RESOLVED_LOW_PRIORITY,
K2_PROPERTY_AS_OPERATOR, // using property of functional type as an operator. From resolution perspective, this is considered successful.
RESOLVED_NEED_PRESERVE_COMPATIBILITY, // call resolved successfully, but using new features that changes resolve
// Tower resolve does not go to further scopes if candidate with applicability below is found
K2_SYNTHETIC_RESOLVED, // used in K2 for (Java) synthetic discrimination at the same level
RESOLVED_WITH_ERROR, // call has error, but it is still successful from resolution perspective
K1_RESOLVED_WITH_ERROR, // call has error, but it is still successful from resolution perspective
RESOLVED, // call success or has uncompleted inference or in other words possible successful candidate
}