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 0c04178b253..7cdec2293ba 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 @@ -81,10 +81,13 @@ public class ResolvedCallImpl implements MutableRe private final ExplicitReceiverKind explicitReceiverKind; private final TypeSubstitutor knownTypeParametersSubstitutor; - private final Map typeArguments = Maps.newLinkedHashMap(); - private final Map valueArguments = Maps.newLinkedHashMap(); + @NotNull + private final Map typeArguments; + @NotNull + private final Map valueArguments; private final MutableDataFlowInfoForArguments dataFlowInfoForArguments; - private final Map argumentToParameterMap = Maps.newHashMap(); + @NotNull + private final Map argumentToParameterMap; private DelegatingBindingTrace trace; private TracingStrategy tracing; @@ -109,6 +112,9 @@ public class ResolvedCallImpl implements MutableRe this.trace = trace; this.tracing = tracing; this.dataFlowInfoForArguments = dataFlowInfoForArguments; + this.typeArguments = createTypeArgumentsMap(candidateDescriptor); + this.valueArguments = createValueArgumentsMap(candidateDescriptor); + this.argumentToParameterMap = createArgumentsToParameterMap(candidateDescriptor); } public ResolvedCallImpl( @@ -131,6 +137,30 @@ public class ResolvedCallImpl implements MutableRe this.trace = trace; this.tracing = tracing; this.dataFlowInfoForArguments = dataFlowInfoForArguments; + this.typeArguments = createTypeArgumentsMap(candidateDescriptor); + this.valueArguments = createValueArgumentsMap(candidateDescriptor); + this.argumentToParameterMap = createArgumentsToParameterMap(candidateDescriptor); + } + + @NotNull + private static Map createValueArgumentsMap(CallableDescriptor descriptor) { + return descriptor.getValueParameters().isEmpty() + ? Collections.emptyMap() + : Maps.newLinkedHashMap(); + } + + @NotNull + private static Map createArgumentsToParameterMap(CallableDescriptor descriptor) { + return descriptor.getValueParameters().isEmpty() + ? Collections.emptyMap() + : Maps.newHashMap(); + } + + @NotNull + private static Map createTypeArgumentsMap(CallableDescriptor descriptor) { + return descriptor.getTypeParameters().isEmpty() + ? Collections.emptyMap() + : Maps.newLinkedHashMap(); } @Override @@ -194,6 +224,8 @@ public class ResolvedCallImpl implements MutableRe } } + if (candidateDescriptor.getValueParameters().isEmpty()) return; + List substitutedParameters = resultingDescriptor.getValueParameters(); Collection> valueArgumentsBeforeSubstitution =