diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.java index cabe0e54c4f..af8a1c5ff3e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.java @@ -25,6 +25,7 @@ import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.util.slicedmap.ReadOnlySlice; import org.jetbrains.jet.util.slicedmap.Slices; +import org.jetbrains.jet.util.slicedmap.WritableSlice; import java.util.*; @@ -265,4 +266,15 @@ public class BindingContextUtils { } trace.report(AMBIGUOUS_LABEL.on(targetLabel)); } + + public static void commitResolutionCacheData(@NotNull DelegatingBindingTrace trace, @NotNull BindingTrace traceForResolutionCache) { + trace.addAllMyDataTo(traceForResolutionCache, new TraceEntryFilter() { + @Override + public boolean accept(@NotNull WritableSlice slice, Object key) { + return slice == BindingContext.RESOLUTION_RESULTS_FOR_FUNCTION || + slice == BindingContext.RESOLUTION_RESULTS_FOR_PROPERTY || + slice == BindingContext.TRACE_DELTAS_CACHE; + } + }, false); + } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java index ece5bca9bcb..c6a7214c768 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java @@ -516,13 +516,7 @@ public class CallResolver { task.getResolvedCalls().add(call); } - context.candidateCall.getTrace().addAllMyDataTo(traceForResolutionCache, new TraceEntryFilter() { - @Override - public boolean accept(@NotNull WritableSlice slice, Object key) { - return slice == BindingContext.RESOLUTION_RESULTS_FOR_FUNCTION || slice == BindingContext.RESOLUTION_RESULTS_FOR_PROPERTY || - slice == BindingContext.TRACE_DELTAS_CACHE; - } - }, false); + BindingContextUtils.commitResolutionCacheData(context.candidateCall.getTrace(), traceForResolutionCache); } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java index 3789d72e756..09714e7a9f2 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java @@ -366,6 +366,7 @@ public class CandidateResolver { expectedType != null ? expectedType : NO_EXPECTED_TYPE, resolveFunctionArgumentBodies).getType(); constraintSystem.addSubtypeConstraint(type, effectiveExpectedType, ConstraintPosition.getValueParameterPosition( valueParameterDescriptor.getIndex())); + BindingContextUtils.commitResolutionCacheData(traceForUnknown, context.trace); if (isErrorType != null) { isErrorType[0] = type == null || ErrorUtils.isErrorType(type); }