diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/DelegatingResolvedCall.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/DelegatingResolvedCall.java index c1a55b4d172..48f618d7a88 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/DelegatingResolvedCall.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/DelegatingResolvedCall.java @@ -87,12 +87,6 @@ public abstract class DelegatingResolvedCall imple return resolvedCall.getValueArguments(); } - @NotNull - @Override - public Map getUnsubstitutedValueArguments() { - return resolvedCall.getUnsubstitutedValueArguments(); - } - @NotNull @Override public ArgumentMapping getArgumentMapping(@NotNull ValueArgument valueArgument) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCall.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCall.java index 1c0f7ddceb4..5d362098793 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCall.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCall.java @@ -64,10 +64,6 @@ public interface ResolvedCall { @NotNull Map getValueArguments(); - /** Values (arguments) for value parameters, no type parameter substitution */ - @NotNull - Map getUnsubstitutedValueArguments(); - /** Values (arguments) for value parameters indexed by parameter index */ @Nullable List getValueArgumentsByIndex(); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java index ac94c9b555c..73d3d2e1aa4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.resolve.calls.model; import com.google.common.collect.Maps; import com.intellij.openapi.diagnostic.Logger; import com.intellij.util.Function; +import com.intellij.util.SmartList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.CallableDescriptor; @@ -41,6 +42,7 @@ import org.jetbrains.kotlin.types.TypeProjection; import org.jetbrains.kotlin.types.TypeSubstitutor; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Map; @@ -84,7 +86,6 @@ public class ResolvedCallImpl implements MutableRe private final Map typeArguments = Maps.newLinkedHashMap(); private final Map valueArguments = Maps.newLinkedHashMap(); - private Map valueArgumentsBeforeSubstitution; private final MutableDataFlowInfoForArguments dataFlowInfoForArguments; private final Map argumentToParameterMap = Maps.newHashMap(); @@ -201,9 +202,12 @@ public class ResolvedCallImpl implements MutableRe substitutedParametersMap.put(valueParameterDescriptor.getOriginal(), valueParameterDescriptor); } - valueArgumentsBeforeSubstitution = Maps.newLinkedHashMap(valueArguments); + Collection> valueArgumentsBeforeSubstitution = + new SmartList>(valueArguments.entrySet()); + valueArguments.clear(); - for (Map.Entry entry : valueArgumentsBeforeSubstitution.entrySet()) { + + for (Map.Entry entry : valueArgumentsBeforeSubstitution) { ValueParameterDescriptor substitutedVersion = substitutedParametersMap.get(entry.getKey().getOriginal()); assert substitutedVersion != null : entry.getKey(); valueArguments.put(substitutedVersion, entry.getValue()); @@ -265,14 +269,6 @@ public class ResolvedCallImpl implements MutableRe return valueArguments; } - @Override - @NotNull - public Map getUnsubstitutedValueArguments() { - // TODO We need unsubstituted value arguments to compare signatures for specificity when explicit type arguments are provided. - // Current implementation is questionable (mostly due to lack of well-defined contract for MutableResolvedCall). - return valueArgumentsBeforeSubstitution != null ? valueArgumentsBeforeSubstitution : valueArguments; - } - @Nullable @Override public List getValueArgumentsByIndex() { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/CandidateCallWithArgumentMapping.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/CandidateCallWithArgumentMapping.kt index e39bdfccaa3..e1a88596449 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/CandidateCallWithArgumentMapping.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/CandidateCallWithArgumentMapping.kt @@ -70,7 +70,7 @@ class CandidateCallWithArgumentMapping private constr var parametersWithDefaultValuesCount = 0 val unsubstitutedValueParameters = call.candidateDescriptor.original.valueParameters - for ((valueParameterDescriptor, resolvedValueArgument) in call.unsubstitutedValueArguments.entries) { + for ((valueParameterDescriptor, resolvedValueArgument) in call.valueArguments.entries) { if (resolvedValueArgument is DefaultValueArgument) { parametersWithDefaultValuesCount++ }