CandidateApplicability: merge INAPPLICABLE_MODIFIER into CONVENTION_ERROR

This commit is contained in:
Mikhail Glukhikh
2022-07-19 14:28:55 +02:00
committed by Space
parent 577b9686c1
commit 8e9e8302f7
5 changed files with 6 additions and 7 deletions
@@ -5,7 +5,7 @@ FILE: implicitTypeOrder.kt
}
public final fun bar(): R|A| {
^bar R|/foo|.<Inapplicable(INAPPLICABLE_MODIFIER): /A.invoke>#()
^bar R|/foo|.<Inapplicable(CONVENTION_ERROR): /A.invoke>#()
}
public final fun invoke(): R|A| {
@@ -26,5 +26,5 @@ FILE: qualifierWithCompanion.kt
local final fun R|my/A|.invoke(): R|kotlin/Unit| {
}
Q|my|.R|my/xx|.<Inapplicable(INAPPLICABLE_MODIFIER): <local>/invoke>#()
Q|my|.R|my/xx|.<Inapplicable(CONVENTION_ERROR): <local>/invoke>#()
}
@@ -119,8 +119,8 @@ class ManyLambdaExpressionArguments(
val argument: FirExpression
) : ResolutionDiagnostic(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR)
class InfixCallOfNonInfixFunction(val function: FirNamedFunctionSymbol) : ResolutionDiagnostic(INAPPLICABLE_MODIFIER)
class OperatorCallOfNonOperatorFunction(val function: FirNamedFunctionSymbol) : ResolutionDiagnostic(INAPPLICABLE_MODIFIER)
class InfixCallOfNonInfixFunction(val function: FirNamedFunctionSymbol) : ResolutionDiagnostic(CONVENTION_ERROR)
class OperatorCallOfNonOperatorFunction(val function: FirNamedFunctionSymbol) : ResolutionDiagnostic(CONVENTION_ERROR)
class InferenceError(val constraintError: ConstraintSystemError) : ResolutionDiagnostic(constraintError.applicability)
class Unsupported(val message: String, val source: KtSourceElement? = null) : ResolutionDiagnostic(UNSUPPORTED)
@@ -13,13 +13,12 @@ enum class CandidateApplicability {
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
INAPPLICABLE_MODIFIER, // no expected modifier (eg infix call on non-infix function)
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.
UNSAFE_CALL, // receiver or argument nullability doesn't match
UNSTABLE_SMARTCAST, // unstable smart cast
CONVENTION_ERROR, // missing infix, operator etc
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.
@@ -6,7 +6,7 @@ fun f(): Unit {
var x: Int? = 1
x = null
x + 1
x <!UNSAFE_INFIX_CALL!>plus<!> 1
x <!INFIX_MODIFIER_REQUIRED!>plus<!> 1
x <!UNSAFE_OPERATOR_CALL!><<!> 1
<!ASSIGNMENT_TYPE_MISMATCH!>x += 1<!>