Wire KotlinTypeRefiner in areCallableDescriptorsEquivalent

See the issue for details

^KT-41218 Fixed
This commit is contained in:
Dmitry Savvinov
2020-08-22 15:20:45 +03:00
parent 421efaa565
commit 5649cbc2e1
14 changed files with 61 additions and 17 deletions
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCallImpl
import org.jetbrains.kotlin.resolve.calls.results.FlatSignature.Companion.argumentValueType
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
import org.jetbrains.kotlin.util.CancellationChecker
import java.util.*
@@ -58,6 +59,7 @@ fun createOverloadingConflictResolver(
specificityComparator: TypeSpecificityComparator,
platformOverloadsSpecificityComparator: PlatformOverloadsSpecificityComparator,
cancellationChecker: CancellationChecker,
kotlinTypeRefiner: KotlinTypeRefiner,
) = OverloadingConflictResolver(
builtIns,
module,
@@ -69,5 +71,6 @@ fun createOverloadingConflictResolver(
MutableResolvedCall<*>::createFlatSignature,
{ (it as? VariableAsFunctionResolvedCallImpl)?.variableCall },
{ DescriptorToSourceUtils.descriptorToDeclaration(it) != null },
null
null,
kotlinTypeRefiner
)
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode;
import org.jetbrains.kotlin.resolve.calls.model.MutableResolvedCall;
import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy;
import org.jetbrains.kotlin.resolve.calls.tower.TowerUtilsKt;
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner;
import org.jetbrains.kotlin.util.CancellationChecker;
import java.util.*;
@@ -46,10 +47,11 @@ public class ResolutionResultsHandler {
@NotNull ModuleDescriptor module,
@NotNull TypeSpecificityComparator specificityComparator,
@NotNull PlatformOverloadsSpecificityComparator platformOverloadsSpecificityComparator,
@NotNull CancellationChecker cancellationChecker
@NotNull CancellationChecker cancellationChecker,
@NotNull KotlinTypeRefiner kotlinTypeRefiner
) {
overloadingConflictResolver = FlatSignatureForResolvedCallKt.createOverloadingConflictResolver(
builtIns, module, specificityComparator, platformOverloadsSpecificityComparator, cancellationChecker
builtIns, module, specificityComparator, platformOverloadsSpecificityComparator, cancellationChecker, kotlinTypeRefiner
);
}
@@ -33,6 +33,8 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.KotlinTypeRefinerImpl
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
interface IdentifierInfo {
@@ -63,7 +65,7 @@ interface IdentifierInfo {
override fun equals(other: Any?) =
other is Variable &&
DescriptorEquivalenceForOverrides.areCallableDescriptorsEquivalent(
variable, other.variable, allowCopiesFromTheSameDeclaration = true
variable, other.variable, allowCopiesFromTheSameDeclaration = true, kotlinTypeRefiner = KotlinTypeRefiner.Default
)
override fun hashCode() = variable.name.hashCode() * 31 + variable.containingDeclaration.original.hashCode()