From 1cadabb0993df265ff6c5c4f4ebda82584f3e9ba Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 26 Aug 2020 12:47:59 +0300 Subject: [PATCH] Extract ResolutionCandidateApplicability to separate file --- .../resolve/calls/tower/ImplicitScopeTower.kt | 16 -------------- .../tower/ResolutionCandidateApplicability.kt | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ResolutionCandidateApplicability.kt diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ImplicitScopeTower.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ImplicitScopeTower.kt index 24055a58c24..638093ce48f 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ImplicitScopeTower.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ImplicitScopeTower.kt @@ -97,22 +97,6 @@ fun getResultApplicability(diagnostics: Collection): Reso fun getResultApplicability(diagnostics: Collection): 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) { diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ResolutionCandidateApplicability.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ResolutionCandidateApplicability.kt new file mode 100644 index 00000000000..83c09522161 --- /dev/null +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ResolutionCandidateApplicability.kt @@ -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) +}