From ece745966b205ce56ba189fb37c00ae336f881b0 Mon Sep 17 00:00:00 2001 From: Cuihtlauac ALVARADO Date: Tue, 11 Sep 2018 17:33:22 +0200 Subject: [PATCH] Remove CandidateWithBoundDispatchReceiverImpl Interface CandidateWithBoundDispatchReceiver had a unique implementation, which was private. Turned interface CandidateWithBoundDispatchReceiver into a class. Removed CandidateWithBoundDispatchReceiverImpl. Removed string "Impl" suffix at constructor call sites. --- .../kotlin/resolve/calls/tower/ImplicitScopeTower.kt | 10 ++++------ .../kotlin/resolve/calls/tower/InvokeProcessors.kt | 2 +- .../kotlin/resolve/calls/tower/TowerLevels.kt | 2 +- .../jetbrains/kotlin/resolve/calls/tower/TowerUtils.kt | 6 ------ 4 files changed, 6 insertions(+), 14 deletions(-) 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 c815a708095..9dd6f831a24 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 @@ -54,13 +54,11 @@ interface ScopeTowerLevel { fun recordLookup(name: Name) } -interface CandidateWithBoundDispatchReceiver { - val descriptor: CallableDescriptor - +class CandidateWithBoundDispatchReceiver( + val dispatchReceiver: ReceiverValueWithSmartCastInfo?, + val descriptor: CallableDescriptor, val diagnostics: List - - val dispatchReceiver: ReceiverValueWithSmartCastInfo? -} +) fun getResultApplicability(diagnostics: Collection) = diagnostics.maxBy { it.candidateApplicability }?.candidateApplicability diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/InvokeProcessors.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/InvokeProcessors.kt index 86e311ca9f2..c3e5978be9f 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/InvokeProcessors.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/InvokeProcessors.kt @@ -214,7 +214,7 @@ private fun ImplicitScopeTower.getExtensionInvokeCandidateDescriptor( ?: error("No single synthesized invoke for $invokeDescriptor: $synthesizedInvokes") // here we don't add SynthesizedDescriptor diagnostic because it should has priority as member - return CandidateWithBoundDispatchReceiverImpl(extensionFunctionReceiver, synthesizedInvoke, listOf()) + return CandidateWithBoundDispatchReceiver(extensionFunctionReceiver, synthesizedInvoke, listOf()) } // case 1.(foo())() or (foo())() diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt index 2819218ad2a..bcaa8db7879 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt @@ -72,7 +72,7 @@ internal abstract class AbstractScopeTowerLevel( )?.let { diagnostics.add(VisibilityError(it)) } } } - return CandidateWithBoundDispatchReceiverImpl(dispatchReceiver, descriptor, diagnostics) + return CandidateWithBoundDispatchReceiver(dispatchReceiver, descriptor, diagnostics) } } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerUtils.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerUtils.kt index d9fd2e5c8ed..4b9bf9d0a14 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerUtils.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerUtils.kt @@ -38,12 +38,6 @@ val CandidateWithBoundDispatchReceiver.requiresExtensionReceiver: Boolean val ResolutionCandidateApplicability.isInapplicable: Boolean get() = this in INAPPLICABLE_STATUSES -internal class CandidateWithBoundDispatchReceiverImpl( - override val dispatchReceiver: ReceiverValueWithSmartCastInfo?, - override val descriptor: CallableDescriptor, - override val diagnostics: List -) : CandidateWithBoundDispatchReceiver - fun C.forceResolution(): C { resultingApplicability return this