diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/AnnotationResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/AnnotationResolver.java index 731a0cc7260..c8a026e686a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/AnnotationResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/AnnotationResolver.java @@ -172,7 +172,8 @@ public class AnnotationResolver { CallMaker.makeCall(ReceiverValue.NO_RECEIVER, null, annotationEntry), NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, - true); + true + ); } public void resolveAnnotationsArguments(@NotNull JetScope scope, @Nullable JetModifierList modifierList, @NotNull BindingTrace trace) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java index 377c45fee5f..1f20b8019b2 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java @@ -24,11 +24,9 @@ import com.intellij.util.containers.Queue; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.*; -import org.jetbrains.jet.lang.evaluate.EvaluatePackage; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.calls.CallResolver; import org.jetbrains.jet.lang.resolve.calls.context.ContextDependency; -import org.jetbrains.jet.lang.resolve.calls.context.ResolutionResultsCacheImpl; import org.jetbrains.jet.lang.resolve.calls.context.SimpleResolutionContext; import org.jetbrains.jet.lang.resolve.calls.results.OverloadResolutionResults; import org.jetbrains.jet.lang.resolve.calls.util.CallMaker; @@ -38,7 +36,6 @@ import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue; import org.jetbrains.jet.lang.types.*; import org.jetbrains.jet.lang.types.expressions.DataFlowUtils; import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices; -import org.jetbrains.jet.lang.types.expressions.LabelResolver; import org.jetbrains.jet.lexer.JetKeywordToken; import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.util.Box; @@ -203,8 +200,7 @@ public class BodyResolver { if (type != null && supertype != null) { SimpleResolutionContext simpleResolutionContext = new SimpleResolutionContext( trace, scope, supertype, c.getOuterDataFlowInfo(), ContextDependency.INDEPENDENT, - ResolutionResultsCacheImpl.create(), LabelResolver.create(), - expressionTypingServices.createExtension(scope, false), false); + expressionTypingServices.createExtension(scope, false)); DataFlowUtils.checkType(type, delegateExpression, simpleResolutionContext); } } 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 a041282b937..2f01f6b579a 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 @@ -182,10 +182,11 @@ public class CallResolver { @NotNull DataFlowInfo dataFlowInfo, boolean isAnnotationContext ) { - return resolveFunctionCall(BasicCallResolutionContext.create( - trace, scope, call, expectedType, dataFlowInfo, ContextDependency.INDEPENDENT, CheckValueArgumentsMode.ENABLED, - ResolutionResultsCacheImpl.create(), LabelResolver.create(), null, - expressionTypingServices.createExtension(scope, isAnnotationContext), isAnnotationContext)); + return resolveFunctionCall( + BasicCallResolutionContext.create( + trace, scope, call, expectedType, dataFlowInfo, ContextDependency.INDEPENDENT, CheckValueArgumentsMode.ENABLED, + expressionTypingServices.createExtension(scope, isAnnotationContext), isAnnotationContext) + ); } @NotNull diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/context/BasicCallResolutionContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/context/BasicCallResolutionContext.java index 8fa9630c865..a5e964c28cd 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/context/BasicCallResolutionContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/context/BasicCallResolutionContext.java @@ -28,8 +28,7 @@ import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.expressions.LabelResolver; public class BasicCallResolutionContext extends CallResolutionContext { - @NotNull - public static BasicCallResolutionContext create( + private BasicCallResolutionContext( @NotNull BindingTrace trace, @NotNull JetScope scope, @NotNull Call call, @@ -41,11 +40,28 @@ public class BasicCallResolutionContext extends CallResolutionContext @Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments, @NotNull CallResolverExtension callResolverExtension, @NotNull ReceiverValue explicitExtensionReceiverForInvoke, - boolean isAnnotationContext + boolean isAnnotationContext, + boolean collectAllCandidates ) { super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache, labelResolver, - dataFlowInfoForArguments, callResolverExtension, isAnnotationContext); + dataFlowInfoForArguments, callResolverExtension, isAnnotationContext, collectAllCandidates); this.candidateCall = candidateCall; this.tracing = tracing; this.explicitExtensionReceiverForInvoke = explicitExtensionReceiverForInvoke; @@ -69,7 +70,7 @@ public final class CallCandidateResolutionContext candidateCall, tracing, trace, context.scope, call, context.expectedType, context.dataFlowInfo, context.contextDependency, context.checkArguments, context.resolutionResultsCache, context.labelResolver, context.dataFlowInfoForArguments, - context.callResolverExtension, explicitExtensionReceiverForInvoke, context.isAnnotationContext); + context.callResolverExtension, explicitExtensionReceiverForInvoke, context.isAnnotationContext, context.collectAllCandidates); } public static CallCandidateResolutionContext create( @@ -92,7 +93,7 @@ public final class CallCandidateResolutionContext candidateCall, tracing, context.trace, context.scope, context.call, context.expectedType, context.dataFlowInfo, context.contextDependency, context.checkArguments, context.resolutionResultsCache, context.labelResolver, context.dataFlowInfoForArguments, context.callResolverExtension, ReceiverValue.NO_RECEIVER, - context.isAnnotationContext); + context.isAnnotationContext, context.collectAllCandidates); } @Override @@ -103,11 +104,12 @@ public final class CallCandidateResolutionContext @NotNull JetType expectedType, @NotNull ContextDependency contextDependency, @NotNull ResolutionResultsCache resolutionResultsCache, - @NotNull LabelResolver labelResolver + @NotNull LabelResolver labelResolver, + boolean collectAllCandidates ) { return new CallCandidateResolutionContext( candidateCall, tracing, trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache, labelResolver, dataFlowInfoForArguments, callResolverExtension, explicitExtensionReceiverForInvoke, - isAnnotationContext); + isAnnotationContext, collectAllCandidates); } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/context/CallResolutionContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/context/CallResolutionContext.java index eb1e31ca565..703c9135163 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/context/CallResolutionContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/context/CallResolutionContext.java @@ -47,10 +47,11 @@ public abstract class CallResolutionContext { - public SimpleResolutionContext( + private SimpleResolutionContext( @NotNull BindingTrace trace, @NotNull JetScope scope, @NotNull JetType expectedType, @@ -34,10 +34,23 @@ public class SimpleResolutionContext extends ResolutionContext extends C private DescriptorCheckStrategy checkingStrategy; public final TracingStrategy tracing; - public ResolutionTask( + private ResolutionTask( @NotNull Collection> candidates, - @NotNull TracingStrategy tracing, BindingTrace trace, JetScope scope, Call call, JetType expectedType, - DataFlowInfo dataFlowInfo, ContextDependency contextDependency, CheckValueArgumentsMode checkArguments, - ResolutionResultsCache resolutionResultsCache, @NotNull LabelResolver labelResolver, - @Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments, @NotNull CallResolverExtension callResolverExtension, - boolean isAnnotationContext + @NotNull TracingStrategy tracing, + @NotNull BindingTrace trace, + @NotNull JetScope scope, + @NotNull Call call, + @NotNull JetType expectedType, + @NotNull DataFlowInfo dataFlowInfo, + @NotNull ContextDependency contextDependency, + @NotNull CheckValueArgumentsMode checkArguments, + @NotNull ResolutionResultsCache resolutionResultsCache, + @NotNull LabelResolver labelResolver, + @Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments, + @NotNull CallResolverExtension callResolverExtension, + boolean isAnnotationContext, + boolean collectAllCandidates ) { super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache, - labelResolver, dataFlowInfoForArguments, callResolverExtension, isAnnotationContext); + labelResolver, dataFlowInfoForArguments, callResolverExtension, isAnnotationContext, collectAllCandidates); this.candidates = candidates; this.tracing = tracing; } @@ -67,7 +76,7 @@ public class ResolutionTask extends C context.trace, context.scope, context.call, context.expectedType, context.dataFlowInfo, context.contextDependency, context.checkArguments, context.resolutionResultsCache, context.labelResolver, context.dataFlowInfoForArguments, - context.callResolverExtension, context.isAnnotationContext); + context.callResolverExtension, context.isAnnotationContext, context.collectAllCandidates); } public ResolutionTask( @@ -107,11 +116,13 @@ public class ResolutionTask extends C @NotNull JetType expectedType, @NotNull ContextDependency contextDependency, @NotNull ResolutionResultsCache resolutionResultsCache, - @NotNull LabelResolver labelResolver + @NotNull LabelResolver labelResolver, + boolean collectAllCandidates ) { ResolutionTask newTask = new ResolutionTask( candidates, tracing, trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, - resolutionResultsCache, labelResolver, dataFlowInfoForArguments, callResolverExtension, isAnnotationContext); + resolutionResultsCache, labelResolver, dataFlowInfoForArguments, callResolverExtension, isAnnotationContext, + collectAllCandidates); newTask.setCheckingStrategy(checkingStrategy); return newTask; } @@ -119,7 +130,8 @@ public class ResolutionTask extends C public ResolutionTask replaceCall(@NotNull Call newCall) { return new ResolutionTask( candidates, tracing, trace, scope, newCall, expectedType, dataFlowInfo, contextDependency, checkArguments, - resolutionResultsCache, labelResolver, dataFlowInfoForArguments, callResolverExtension, isAnnotationContext); + resolutionResultsCache, labelResolver, dataFlowInfoForArguments, callResolverExtension, + isAnnotationContext, collectAllCandidates); } public interface DescriptorCheckStrategy { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingContext.java index 8a1b01733e3..9de90faa764 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingContext.java @@ -45,11 +45,12 @@ public class ExpressionTypingContext extends ResolutionContext