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 504920ee7c7..6c55ede560d 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 @@ -42,6 +42,7 @@ import org.jetbrains.kotlin.types.TypeSubstitutor; import org.jetbrains.kotlin.types.Variance; import java.util.*; +import java.util.stream.Collectors; import static org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus.INCOMPLETE_TYPE_INFERENCE; import static org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus.UNKNOWN_STATUS; @@ -68,7 +69,7 @@ public class ResolvedCallImpl implements MutableRe private final TypeSubstitutor knownTypeParametersSubstitutor; @NotNull - private final Map typeArguments; + private Map typeArguments; @NotNull private final Map valueArguments; private final MutableDataFlowInfoForArguments dataFlowInfoForArguments; @@ -213,6 +214,9 @@ public class ResolvedCallImpl implements MutableRe } } + typeArguments = typeArguments.entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, e -> substitutor.safeSubstitute(e.getValue(), e.getKey().getVariance()))); + if (dispatchReceiver instanceof ExpressionReceiver) { dispatchReceiver = dispatchReceiver.replaceType(substitutor.safeSubstitute(dispatchReceiver.getType(), Variance.IN_VARIANCE)); }