Extract ResolutionCandidateApplicability to separate file

This commit is contained in:
Dmitriy Novozhilov
2020-08-26 12:47:59 +03:00
parent 775df6dfc3
commit 1cadabb099
2 changed files with 22 additions and 16 deletions
@@ -97,22 +97,6 @@ fun getResultApplicability(diagnostics: Collection<ConstraintSystemError>): Reso
fun getResultApplicability(diagnostics: Collection<KotlinCallDiagnostic>): ResolutionCandidateApplicability =
diagnostics.maxByOrNull { it.candidateApplicability }?.candidateApplicability ?: RESOLVED
enum class ResolutionCandidateApplicability {
RESOLVED, // call success or has uncompleted inference or in other words possible successful candidate
RESOLVED_WITH_ERROR, // call has error, but it is still successful from resolution perspective
RESOLVED_NEED_PRESERVE_COMPATIBILITY, // call resolved successfully, but using new features that changes resolve
RESOLVED_LOW_PRIORITY,
CONVENTION_ERROR, // missing infix, operator etc
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 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
RESOLVED_TO_SAM_WITH_VARARG, // migration warning up to 1.5 (when resolve to function with SAM conversion and array without spread as vararg)
}
abstract class ResolutionDiagnostic(candidateApplicability: ResolutionCandidateApplicability) :
KotlinCallDiagnostic(candidateApplicability) {
override fun report(reporter: DiagnosticReporter) {
@@ -0,0 +1,22 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.resolve.calls.tower
enum class ResolutionCandidateApplicability {
RESOLVED, // call success or has uncompleted inference or in other words possible successful candidate
RESOLVED_WITH_ERROR, // call has error, but it is still successful from resolution perspective
RESOLVED_NEED_PRESERVE_COMPATIBILITY, // call resolved successfully, but using new features that changes resolve
RESOLVED_LOW_PRIORITY,
CONVENTION_ERROR, // missing infix, operator etc
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 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
RESOLVED_TO_SAM_WITH_VARARG, // migration warning up to 1.5 (when resolve to function with SAM conversion and array without spread as vararg)
}