Frontend: CallResolverExtension->CallChecker
This commit is contained in:
@@ -78,7 +78,7 @@ public class CallCompleter(
|
|||||||
temporaryTrace.commit()
|
temporaryTrace.commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
resolvedCall?.let { context.callResolverExtension.run(it, context) }
|
resolvedCall?.let { context.callChecker.check(it, context) }
|
||||||
|
|
||||||
if (results.isSingleResult() && results.getResultingCall().getStatus().isSuccess()) {
|
if (results.isSingleResult() && results.getResultingCall().getStatus().isSuccess()) {
|
||||||
return results.changeStatusToSuccess()
|
return results.changeStatusToSuccess()
|
||||||
|
|||||||
+3
-3
@@ -14,13 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.calls.extensions;
|
package org.jetbrains.kotlin.resolve.calls.checkers;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext;
|
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext;
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||||
|
|
||||||
public interface CallResolverExtension {
|
public interface CallChecker {
|
||||||
<F extends CallableDescriptor> void run(@NotNull ResolvedCall<F> resolvedCall, @NotNull BasicCallResolutionContext context);
|
<F extends CallableDescriptor> void check(@NotNull ResolvedCall<F> resolvedCall, @NotNull BasicCallResolutionContext context);
|
||||||
}
|
}
|
||||||
+19
-19
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.calls.extensions;
|
package org.jetbrains.kotlin.resolve.calls.checkers;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -26,38 +26,38 @@ import java.util.*;
|
|||||||
|
|
||||||
public class CallResolverExtensionProvider {
|
public class CallResolverExtensionProvider {
|
||||||
|
|
||||||
private final static CompositeExtension DEFAULT =
|
private final static CompositeChecker DEFAULT =
|
||||||
new CompositeExtension(Arrays.asList(
|
new CompositeChecker(Arrays.asList(
|
||||||
new NeedSyntheticCallResolverExtension(),
|
new NeedSyntheticChecker(),
|
||||||
new ReifiedTypeParameterSubstitutionCheck(),
|
new ReifiedTypeParameterSubstitutionChecker(),
|
||||||
new CapturingInClosureExtension()
|
new CapturingInClosureChecker()
|
||||||
));
|
));
|
||||||
|
|
||||||
private WeakReference<Map<DeclarationDescriptor, List<CallResolverExtension>>> extensionsCache;
|
private WeakReference<Map<DeclarationDescriptor, List<CallChecker>>> extensionsCache;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public CallResolverExtension createExtension(@Nullable DeclarationDescriptor descriptor, boolean isAnnotationContext) {
|
public CallChecker createExtension(@Nullable DeclarationDescriptor descriptor, boolean isAnnotationContext) {
|
||||||
if (descriptor == null || isAnnotationContext) {
|
if (descriptor == null || isAnnotationContext) {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
}
|
}
|
||||||
return new CompositeExtension(createExtensions(descriptor));
|
return new CompositeChecker(createExtensions(descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// create extension list with default one at the end
|
// create extension list with default one at the end
|
||||||
@NotNull
|
@NotNull
|
||||||
private List<CallResolverExtension> createExtensions(@NotNull DeclarationDescriptor declaration) {
|
private List<CallChecker> createExtensions(@NotNull DeclarationDescriptor declaration) {
|
||||||
Map<DeclarationDescriptor, List<CallResolverExtension>> map;
|
Map<DeclarationDescriptor, List<CallChecker>> map;
|
||||||
if (extensionsCache == null || (map = extensionsCache.get()) == null) {
|
if (extensionsCache == null || (map = extensionsCache.get()) == null) {
|
||||||
map = new HashMap<DeclarationDescriptor, List<CallResolverExtension>>();
|
map = new HashMap<DeclarationDescriptor, List<CallChecker>>();
|
||||||
extensionsCache = new WeakReference<Map<DeclarationDescriptor, List<CallResolverExtension>>>(map);
|
extensionsCache = new WeakReference<Map<DeclarationDescriptor, List<CallChecker>>>(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CallResolverExtension> extensions = map.get(declaration);
|
List<CallChecker> extensions = map.get(declaration);
|
||||||
if (extensions != null) {
|
if (extensions != null) {
|
||||||
return extensions;
|
return extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
extensions = new ArrayList<CallResolverExtension>();
|
extensions = new ArrayList<CallChecker>();
|
||||||
|
|
||||||
DeclarationDescriptor parent = declaration.getContainingDeclaration();
|
DeclarationDescriptor parent = declaration.getContainingDeclaration();
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
@@ -67,21 +67,21 @@ public class CallResolverExtensionProvider {
|
|||||||
|
|
||||||
appendExtensionsFor(declaration, extensions);
|
appendExtensionsFor(declaration, extensions);
|
||||||
|
|
||||||
List<CallResolverExtension> immutableResult = Collections.unmodifiableList(extensions);
|
List<CallChecker> immutableResult = Collections.unmodifiableList(extensions);
|
||||||
map.put(declaration, immutableResult);
|
map.put(declaration, immutableResult);
|
||||||
|
|
||||||
return immutableResult;
|
return immutableResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
// with default one at the end
|
// with default one at the end
|
||||||
private static void appendExtensionsFor(DeclarationDescriptor declarationDescriptor, List<CallResolverExtension> extensions) {
|
private static void appendExtensionsFor(DeclarationDescriptor declarationDescriptor, List<CallChecker> extensions) {
|
||||||
if (declarationDescriptor instanceof SimpleFunctionDescriptor) {
|
if (declarationDescriptor instanceof SimpleFunctionDescriptor) {
|
||||||
SimpleFunctionDescriptor descriptor = (SimpleFunctionDescriptor) declarationDescriptor;
|
SimpleFunctionDescriptor descriptor = (SimpleFunctionDescriptor) declarationDescriptor;
|
||||||
if (descriptor.getInlineStrategy().isInline()) {
|
if (descriptor.getInlineStrategy().isInline()) {
|
||||||
extensions.add(new InlineCallResolverExtension(descriptor));
|
extensions.add(new InlineChecker(descriptor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add your extensions here
|
// add your checkers here
|
||||||
extensions.add(DEFAULT);
|
extensions.add(DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.calls.extensions
|
package org.jetbrains.kotlin.resolve.calls.checkers
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||||
@@ -33,8 +33,8 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.*
|
|||||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
|
||||||
|
|
||||||
class CapturingInClosureExtension : CallResolverExtension {
|
class CapturingInClosureChecker : CallChecker {
|
||||||
override fun <F : CallableDescriptor> run(resolvedCall: ResolvedCall<F>, context: BasicCallResolutionContext) {
|
override fun <F : CallableDescriptor> check(resolvedCall: ResolvedCall<F>, context: BasicCallResolutionContext) {
|
||||||
val variableResolvedCall = if (resolvedCall is VariableAsFunctionResolvedCall) resolvedCall.variableCall else resolvedCall
|
val variableResolvedCall = if (resolvedCall is VariableAsFunctionResolvedCall) resolvedCall.variableCall else resolvedCall
|
||||||
val variableDescriptor = variableResolvedCall.getResultingDescriptor() as? VariableDescriptor
|
val variableDescriptor = variableResolvedCall.getResultingDescriptor() as? VariableDescriptor
|
||||||
if (variableDescriptor != null) {
|
if (variableDescriptor != null) {
|
||||||
+7
-7
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.calls.extensions;
|
package org.jetbrains.kotlin.resolve.calls.checkers;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||||
@@ -23,21 +23,21 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CompositeExtension implements CallResolverExtension {
|
public class CompositeChecker implements CallChecker {
|
||||||
|
|
||||||
private final List<CallResolverExtension> extensions;
|
private final List<CallChecker> extensions;
|
||||||
|
|
||||||
public CompositeExtension(@NotNull List<CallResolverExtension> extensions) {
|
public CompositeChecker(@NotNull List<CallChecker> extensions) {
|
||||||
this.extensions = extensions;
|
this.extensions = extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <F extends CallableDescriptor> void run(
|
public <F extends CallableDescriptor> void check(
|
||||||
@NotNull ResolvedCall<F> resolvedCall,
|
@NotNull ResolvedCall<F> resolvedCall,
|
||||||
@NotNull BasicCallResolutionContext context
|
@NotNull BasicCallResolutionContext context
|
||||||
) {
|
) {
|
||||||
for (CallResolverExtension resolverExtension : extensions) {
|
for (CallChecker resolverExtension : extensions) {
|
||||||
resolverExtension.run(resolvedCall, context);
|
resolverExtension.check(resolvedCall, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.calls.extensions;
|
package org.jetbrains.kotlin.resolve.calls.checkers;
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
@@ -46,7 +46,7 @@ import java.util.Set;
|
|||||||
import static org.jetbrains.kotlin.resolve.InlineDescriptorUtils.allowsNonLocalReturns;
|
import static org.jetbrains.kotlin.resolve.InlineDescriptorUtils.allowsNonLocalReturns;
|
||||||
import static org.jetbrains.kotlin.resolve.InlineDescriptorUtils.checkNonLocalReturnUsage;
|
import static org.jetbrains.kotlin.resolve.InlineDescriptorUtils.checkNonLocalReturnUsage;
|
||||||
|
|
||||||
public class InlineCallResolverExtension implements CallResolverExtension {
|
public class InlineChecker implements CallChecker {
|
||||||
|
|
||||||
private final SimpleFunctionDescriptor descriptor;
|
private final SimpleFunctionDescriptor descriptor;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ public class InlineCallResolverExtension implements CallResolverExtension {
|
|||||||
|
|
||||||
private final boolean isEffectivelyPublicApiFunction;
|
private final boolean isEffectivelyPublicApiFunction;
|
||||||
|
|
||||||
public InlineCallResolverExtension(@NotNull SimpleFunctionDescriptor descriptor) {
|
public InlineChecker(@NotNull SimpleFunctionDescriptor descriptor) {
|
||||||
assert descriptor.getInlineStrategy().isInline() : "This extension should be created only for inline functions but not " + descriptor;
|
assert descriptor.getInlineStrategy().isInline() : "This extension should be created only for inline functions but not " + descriptor;
|
||||||
this.descriptor = descriptor;
|
this.descriptor = descriptor;
|
||||||
this.isEffectivelyPublicApiFunction = isEffectivelyPublicApi(descriptor);
|
this.isEffectivelyPublicApiFunction = isEffectivelyPublicApi(descriptor);
|
||||||
@@ -75,7 +75,7 @@ public class InlineCallResolverExtension implements CallResolverExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <F extends CallableDescriptor> void run(@NotNull ResolvedCall<F> resolvedCall, @NotNull BasicCallResolutionContext context) {
|
public <F extends CallableDescriptor> void check(@NotNull ResolvedCall<F> resolvedCall, @NotNull BasicCallResolutionContext context) {
|
||||||
JetExpression expression = context.call.getCalleeExpression();
|
JetExpression expression = context.call.getCalleeExpression();
|
||||||
if (expression == null) {
|
if (expression == null) {
|
||||||
return;
|
return;
|
||||||
+3
-3
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.calls.extensions;
|
package org.jetbrains.kotlin.resolve.calls.checkers;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||||
@@ -26,10 +26,10 @@ import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
|||||||
|
|
||||||
import static org.jetbrains.kotlin.resolve.BindingContext.NEED_SYNTHETIC_ACCESSOR;
|
import static org.jetbrains.kotlin.resolve.BindingContext.NEED_SYNTHETIC_ACCESSOR;
|
||||||
|
|
||||||
public class NeedSyntheticCallResolverExtension implements CallResolverExtension {
|
public class NeedSyntheticChecker implements CallChecker {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <F extends CallableDescriptor> void run(
|
public <F extends CallableDescriptor> void check(
|
||||||
@NotNull ResolvedCall<F> resolvedCall,
|
@NotNull ResolvedCall<F> resolvedCall,
|
||||||
@NotNull BasicCallResolutionContext context
|
@NotNull BasicCallResolutionContext context
|
||||||
) {
|
) {
|
||||||
+3
-3
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.calls.extensions;
|
package org.jetbrains.kotlin.resolve.calls.checkers;
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -30,9 +30,9 @@ import org.jetbrains.kotlin.types.typeUtil.TypeUtilPackage;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ReifiedTypeParameterSubstitutionCheck implements CallResolverExtension {
|
public class ReifiedTypeParameterSubstitutionChecker implements CallChecker {
|
||||||
@Override
|
@Override
|
||||||
public <F extends CallableDescriptor> void run(
|
public <F extends CallableDescriptor> void check(
|
||||||
@NotNull ResolvedCall<F> resolvedCall, @NotNull BasicCallResolutionContext context
|
@NotNull ResolvedCall<F> resolvedCall, @NotNull BasicCallResolutionContext context
|
||||||
) {
|
) {
|
||||||
Map<TypeParameterDescriptor, JetType> typeArguments = resolvedCall.getTypeArguments();
|
Map<TypeParameterDescriptor, JetType> typeArguments = resolvedCall.getTypeArguments();
|
||||||
+8
-8
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.psi.Call;
|
import org.jetbrains.kotlin.psi.Call;
|
||||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||||
import org.jetbrains.kotlin.resolve.calls.extensions.CallResolverExtension;
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
|
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||||
@@ -37,12 +37,12 @@ public class BasicCallResolutionContext extends CallResolutionContext<BasicCallR
|
|||||||
@NotNull CheckValueArgumentsMode checkArguments,
|
@NotNull CheckValueArgumentsMode checkArguments,
|
||||||
@NotNull ResolutionResultsCache resolutionResultsCache,
|
@NotNull ResolutionResultsCache resolutionResultsCache,
|
||||||
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments,
|
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments,
|
||||||
@NotNull CallResolverExtension callResolverExtension,
|
@NotNull CallChecker callChecker,
|
||||||
boolean isAnnotationContext,
|
boolean isAnnotationContext,
|
||||||
boolean collectAllCandidates
|
boolean collectAllCandidates
|
||||||
) {
|
) {
|
||||||
super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
|
super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
|
||||||
dataFlowInfoForArguments, callResolverExtension, isAnnotationContext, collectAllCandidates);
|
dataFlowInfoForArguments, callChecker, isAnnotationContext, collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -54,12 +54,12 @@ public class BasicCallResolutionContext extends CallResolutionContext<BasicCallR
|
|||||||
@NotNull DataFlowInfo dataFlowInfo,
|
@NotNull DataFlowInfo dataFlowInfo,
|
||||||
@NotNull ContextDependency contextDependency,
|
@NotNull ContextDependency contextDependency,
|
||||||
@NotNull CheckValueArgumentsMode checkArguments,
|
@NotNull CheckValueArgumentsMode checkArguments,
|
||||||
@NotNull CallResolverExtension callResolverExtension,
|
@NotNull CallChecker callChecker,
|
||||||
boolean isAnnotationContext
|
boolean isAnnotationContext
|
||||||
) {
|
) {
|
||||||
return new BasicCallResolutionContext(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments,
|
return new BasicCallResolutionContext(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments,
|
||||||
new ResolutionResultsCacheImpl(), null,
|
new ResolutionResultsCacheImpl(), null,
|
||||||
callResolverExtension, isAnnotationContext, false);
|
callChecker, isAnnotationContext, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -68,7 +68,7 @@ public class BasicCallResolutionContext extends CallResolutionContext<BasicCallR
|
|||||||
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments
|
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments
|
||||||
) {
|
) {
|
||||||
return new BasicCallResolutionContext(context.trace, context.scope, call, context.expectedType, context.dataFlowInfo, context.contextDependency, checkArguments,
|
return new BasicCallResolutionContext(context.trace, context.scope, call, context.expectedType, context.dataFlowInfo, context.contextDependency, checkArguments,
|
||||||
context.resolutionResultsCache, dataFlowInfoForArguments, context.callResolverExtension,
|
context.resolutionResultsCache, dataFlowInfoForArguments, context.callChecker,
|
||||||
context.isAnnotationContext, context.collectAllCandidates);
|
context.isAnnotationContext, context.collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,13 +91,13 @@ public class BasicCallResolutionContext extends CallResolutionContext<BasicCallR
|
|||||||
) {
|
) {
|
||||||
return new BasicCallResolutionContext(
|
return new BasicCallResolutionContext(
|
||||||
trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
|
trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
|
||||||
dataFlowInfoForArguments, callResolverExtension, isAnnotationContext, collectAllCandidates);
|
dataFlowInfoForArguments, callChecker, isAnnotationContext, collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public BasicCallResolutionContext replaceCall(@NotNull Call newCall) {
|
public BasicCallResolutionContext replaceCall(@NotNull Call newCall) {
|
||||||
return new BasicCallResolutionContext(
|
return new BasicCallResolutionContext(
|
||||||
trace, scope, newCall, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
|
trace, scope, newCall, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
|
||||||
dataFlowInfoForArguments, callResolverExtension, isAnnotationContext, collectAllCandidates);
|
dataFlowInfoForArguments, callChecker, isAnnotationContext, collectAllCandidates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||||
import org.jetbrains.kotlin.psi.Call;
|
import org.jetbrains.kotlin.psi.Call;
|
||||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||||
import org.jetbrains.kotlin.resolve.calls.extensions.CallResolverExtension;
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
|
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.MutableResolvedCall;
|
import org.jetbrains.kotlin.resolve.calls.model.MutableResolvedCall;
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||||
@@ -50,13 +50,13 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor>
|
|||||||
@NotNull CheckValueArgumentsMode checkArguments,
|
@NotNull CheckValueArgumentsMode checkArguments,
|
||||||
@NotNull ResolutionResultsCache resolutionResultsCache,
|
@NotNull ResolutionResultsCache resolutionResultsCache,
|
||||||
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments,
|
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments,
|
||||||
@NotNull CallResolverExtension callResolverExtension,
|
@NotNull CallChecker callChecker,
|
||||||
@NotNull ReceiverValue explicitExtensionReceiverForInvoke,
|
@NotNull ReceiverValue explicitExtensionReceiverForInvoke,
|
||||||
boolean isAnnotationContext,
|
boolean isAnnotationContext,
|
||||||
boolean collectAllCandidates
|
boolean collectAllCandidates
|
||||||
) {
|
) {
|
||||||
super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
|
super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
|
||||||
dataFlowInfoForArguments, callResolverExtension, isAnnotationContext, collectAllCandidates);
|
dataFlowInfoForArguments, callChecker, isAnnotationContext, collectAllCandidates);
|
||||||
this.candidateCall = candidateCall;
|
this.candidateCall = candidateCall;
|
||||||
this.tracing = tracing;
|
this.tracing = tracing;
|
||||||
this.explicitExtensionReceiverForInvoke = explicitExtensionReceiverForInvoke;
|
this.explicitExtensionReceiverForInvoke = explicitExtensionReceiverForInvoke;
|
||||||
@@ -71,7 +71,7 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor>
|
|||||||
candidateCall, tracing, trace, context.scope, call, context.expectedType,
|
candidateCall, tracing, trace, context.scope, call, context.expectedType,
|
||||||
context.dataFlowInfo, context.contextDependency, context.checkArguments,
|
context.dataFlowInfo, context.contextDependency, context.checkArguments,
|
||||||
context.resolutionResultsCache, context.dataFlowInfoForArguments,
|
context.resolutionResultsCache, context.dataFlowInfoForArguments,
|
||||||
context.callResolverExtension, explicitExtensionReceiverForInvoke, context.isAnnotationContext, context.collectAllCandidates);
|
context.callChecker, explicitExtensionReceiverForInvoke, context.isAnnotationContext, context.collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> create(
|
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> create(
|
||||||
@@ -94,7 +94,7 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor>
|
|||||||
return new CallCandidateResolutionContext<D>(
|
return new CallCandidateResolutionContext<D>(
|
||||||
candidateCall, tracing, context.trace, context.scope, context.call, context.expectedType,
|
candidateCall, tracing, context.trace, context.scope, context.call, context.expectedType,
|
||||||
context.dataFlowInfo, context.contextDependency, context.checkArguments, context.resolutionResultsCache,
|
context.dataFlowInfo, context.contextDependency, context.checkArguments, context.resolutionResultsCache,
|
||||||
context.dataFlowInfoForArguments, context.callResolverExtension, ReceiverValue.NO_RECEIVER,
|
context.dataFlowInfoForArguments, context.callChecker, ReceiverValue.NO_RECEIVER,
|
||||||
context.isAnnotationContext, context.collectAllCandidates);
|
context.isAnnotationContext, context.collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor>
|
|||||||
) {
|
) {
|
||||||
return new CallCandidateResolutionContext<D>(
|
return new CallCandidateResolutionContext<D>(
|
||||||
candidateCall, tracing, trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments,
|
candidateCall, tracing, trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments,
|
||||||
resolutionResultsCache, dataFlowInfoForArguments, callResolverExtension, explicitExtensionReceiverForInvoke,
|
resolutionResultsCache, dataFlowInfoForArguments, callChecker, explicitExtensionReceiverForInvoke,
|
||||||
isAnnotationContext, collectAllCandidates);
|
isAnnotationContext, collectAllCandidates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.psi.Call;
|
import org.jetbrains.kotlin.psi.Call;
|
||||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||||
import org.jetbrains.kotlin.resolve.calls.extensions.CallResolverExtension;
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.DataFlowInfoForArgumentsImpl;
|
import org.jetbrains.kotlin.resolve.calls.model.DataFlowInfoForArgumentsImpl;
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
|
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||||
@@ -46,11 +46,11 @@ public abstract class CallResolutionContext<Context extends CallResolutionContex
|
|||||||
@NotNull ResolutionResultsCache resolutionResultsCache,
|
@NotNull ResolutionResultsCache resolutionResultsCache,
|
||||||
@SuppressWarnings("NullableProblems")
|
@SuppressWarnings("NullableProblems")
|
||||||
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments,
|
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments,
|
||||||
@NotNull CallResolverExtension callResolverExtension,
|
@NotNull CallChecker callChecker,
|
||||||
boolean isAnnotationContext,
|
boolean isAnnotationContext,
|
||||||
boolean collectAllCandidates
|
boolean collectAllCandidates
|
||||||
) {
|
) {
|
||||||
super(trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache, callResolverExtension,
|
super(trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache, callChecker,
|
||||||
isAnnotationContext, collectAllCandidates);
|
isAnnotationContext, collectAllCandidates);
|
||||||
this.call = call;
|
this.call = call;
|
||||||
this.checkArguments = checkArguments;
|
this.checkArguments = checkArguments;
|
||||||
|
|||||||
+4
-4
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.resolve.calls.context;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||||
import org.jetbrains.kotlin.resolve.calls.extensions.CallResolverExtension;
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.kotlin.types.JetType;
|
import org.jetbrains.kotlin.types.JetType;
|
||||||
@@ -39,7 +39,7 @@ public abstract class ResolutionContext<Context extends ResolutionContext<Contex
|
|||||||
@NotNull
|
@NotNull
|
||||||
public final ResolutionResultsCache resolutionResultsCache;
|
public final ResolutionResultsCache resolutionResultsCache;
|
||||||
@NotNull
|
@NotNull
|
||||||
public final CallResolverExtension callResolverExtension;
|
public final CallChecker callChecker;
|
||||||
|
|
||||||
public final boolean isAnnotationContext;
|
public final boolean isAnnotationContext;
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ public abstract class ResolutionContext<Context extends ResolutionContext<Contex
|
|||||||
@NotNull DataFlowInfo dataFlowInfo,
|
@NotNull DataFlowInfo dataFlowInfo,
|
||||||
@NotNull ContextDependency contextDependency,
|
@NotNull ContextDependency contextDependency,
|
||||||
@NotNull ResolutionResultsCache resolutionResultsCache,
|
@NotNull ResolutionResultsCache resolutionResultsCache,
|
||||||
@NotNull CallResolverExtension callResolverExtension,
|
@NotNull CallChecker callChecker,
|
||||||
boolean isAnnotationContext,
|
boolean isAnnotationContext,
|
||||||
boolean collectAllCandidates
|
boolean collectAllCandidates
|
||||||
) {
|
) {
|
||||||
@@ -62,7 +62,7 @@ public abstract class ResolutionContext<Context extends ResolutionContext<Contex
|
|||||||
this.dataFlowInfo = dataFlowInfo;
|
this.dataFlowInfo = dataFlowInfo;
|
||||||
this.contextDependency = contextDependency;
|
this.contextDependency = contextDependency;
|
||||||
this.resolutionResultsCache = resolutionResultsCache;
|
this.resolutionResultsCache = resolutionResultsCache;
|
||||||
this.callResolverExtension = callResolverExtension;
|
this.callChecker = callChecker;
|
||||||
this.isAnnotationContext = isAnnotationContext;
|
this.isAnnotationContext = isAnnotationContext;
|
||||||
this.collectAllCandidates = collectAllCandidates;
|
this.collectAllCandidates = collectAllCandidates;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.resolve.calls.context;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||||
import org.jetbrains.kotlin.resolve.calls.extensions.CallResolverExtension;
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.kotlin.types.JetType;
|
import org.jetbrains.kotlin.types.JetType;
|
||||||
@@ -31,11 +31,11 @@ public class SimpleResolutionContext extends ResolutionContext<SimpleResolutionC
|
|||||||
@NotNull DataFlowInfo dataFlowInfo,
|
@NotNull DataFlowInfo dataFlowInfo,
|
||||||
@NotNull ContextDependency contextDependency,
|
@NotNull ContextDependency contextDependency,
|
||||||
@NotNull ResolutionResultsCache resolutionResultsCache,
|
@NotNull ResolutionResultsCache resolutionResultsCache,
|
||||||
@NotNull CallResolverExtension callResolverExtension,
|
@NotNull CallChecker callChecker,
|
||||||
boolean isAnnotationContext,
|
boolean isAnnotationContext,
|
||||||
boolean collectAllCandidates
|
boolean collectAllCandidates
|
||||||
) {
|
) {
|
||||||
super(trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache, callResolverExtension,
|
super(trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache, callChecker,
|
||||||
isAnnotationContext, collectAllCandidates);
|
isAnnotationContext, collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,10 +45,10 @@ public class SimpleResolutionContext extends ResolutionContext<SimpleResolutionC
|
|||||||
@NotNull JetType expectedType,
|
@NotNull JetType expectedType,
|
||||||
@NotNull DataFlowInfo dataFlowInfo,
|
@NotNull DataFlowInfo dataFlowInfo,
|
||||||
@NotNull ContextDependency contextDependency,
|
@NotNull ContextDependency contextDependency,
|
||||||
@NotNull CallResolverExtension callResolverExtension
|
@NotNull CallChecker callChecker
|
||||||
) {
|
) {
|
||||||
this(trace, scope, expectedType, dataFlowInfo, contextDependency, new ResolutionResultsCacheImpl(),
|
this(trace, scope, expectedType, dataFlowInfo, contextDependency, new ResolutionResultsCacheImpl(),
|
||||||
callResolverExtension, false, false);
|
callChecker, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -62,7 +62,7 @@ public class SimpleResolutionContext extends ResolutionContext<SimpleResolutionC
|
|||||||
boolean collectAllCandidates
|
boolean collectAllCandidates
|
||||||
) {
|
) {
|
||||||
return new SimpleResolutionContext(
|
return new SimpleResolutionContext(
|
||||||
trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache, callResolverExtension,
|
trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache, callChecker,
|
||||||
isAnnotationContext, collectAllCandidates);
|
isAnnotationContext, collectAllCandidates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.psi.Call;
|
|||||||
import org.jetbrains.kotlin.psi.JetReferenceExpression;
|
import org.jetbrains.kotlin.psi.JetReferenceExpression;
|
||||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.*;
|
import org.jetbrains.kotlin.resolve.calls.context.*;
|
||||||
import org.jetbrains.kotlin.resolve.calls.extensions.CallResolverExtension;
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
|
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.MutableResolvedCall;
|
import org.jetbrains.kotlin.resolve.calls.model.MutableResolvedCall;
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||||
@@ -54,13 +54,13 @@ public class ResolutionTask<D extends CallableDescriptor, F extends D> extends C
|
|||||||
@NotNull CheckValueArgumentsMode checkArguments,
|
@NotNull CheckValueArgumentsMode checkArguments,
|
||||||
@NotNull ResolutionResultsCache resolutionResultsCache,
|
@NotNull ResolutionResultsCache resolutionResultsCache,
|
||||||
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments,
|
@Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments,
|
||||||
@NotNull CallResolverExtension callResolverExtension,
|
@NotNull CallChecker callChecker,
|
||||||
@NotNull Collection<MutableResolvedCall<F>> resolvedCalls,
|
@NotNull Collection<MutableResolvedCall<F>> resolvedCalls,
|
||||||
boolean isAnnotationContext,
|
boolean isAnnotationContext,
|
||||||
boolean collectAllCandidates
|
boolean collectAllCandidates
|
||||||
) {
|
) {
|
||||||
super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
|
super(trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments, resolutionResultsCache,
|
||||||
dataFlowInfoForArguments, callResolverExtension, isAnnotationContext, collectAllCandidates);
|
dataFlowInfoForArguments, callChecker, isAnnotationContext, collectAllCandidates);
|
||||||
this.lazyCandidates = lazyCandidates;
|
this.lazyCandidates = lazyCandidates;
|
||||||
this.resolvedCalls = resolvedCalls;
|
this.resolvedCalls = resolvedCalls;
|
||||||
this.tracing = tracing;
|
this.tracing = tracing;
|
||||||
@@ -75,7 +75,7 @@ public class ResolutionTask<D extends CallableDescriptor, F extends D> extends C
|
|||||||
context.trace, context.scope, context.call,
|
context.trace, context.scope, context.call,
|
||||||
context.expectedType, context.dataFlowInfo, context.contextDependency, context.checkArguments,
|
context.expectedType, context.dataFlowInfo, context.contextDependency, context.checkArguments,
|
||||||
context.resolutionResultsCache, context.dataFlowInfoForArguments,
|
context.resolutionResultsCache, context.dataFlowInfoForArguments,
|
||||||
context.callResolverExtension, Lists.<MutableResolvedCall<F>>newArrayList(), context.isAnnotationContext, context.collectAllCandidates);
|
context.callChecker, Lists.<MutableResolvedCall<F>>newArrayList(), context.isAnnotationContext, context.collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResolutionTask(
|
public ResolutionTask(
|
||||||
@@ -117,7 +117,7 @@ public class ResolutionTask<D extends CallableDescriptor, F extends D> extends C
|
|||||||
) {
|
) {
|
||||||
return new ResolutionTask<D, F>(
|
return new ResolutionTask<D, F>(
|
||||||
lazyCandidates, tracing, trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments,
|
lazyCandidates, tracing, trace, scope, call, expectedType, dataFlowInfo, contextDependency, checkArguments,
|
||||||
resolutionResultsCache, dataFlowInfoForArguments, callResolverExtension, resolvedCalls, isAnnotationContext,
|
resolutionResultsCache, dataFlowInfoForArguments, callChecker, resolvedCalls, isAnnotationContext,
|
||||||
collectAllCandidates);
|
collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ public class ResolutionTask<D extends CallableDescriptor, F extends D> extends C
|
|||||||
public ResolutionTask<D, F> replaceCall(@NotNull Call newCall) {
|
public ResolutionTask<D, F> replaceCall(@NotNull Call newCall) {
|
||||||
return new ResolutionTask<D, F>(
|
return new ResolutionTask<D, F>(
|
||||||
lazyCandidates, tracing, trace, scope, newCall, expectedType, dataFlowInfo, contextDependency, checkArguments,
|
lazyCandidates, tracing, trace, scope, newCall, expectedType, dataFlowInfo, contextDependency, checkArguments,
|
||||||
resolutionResultsCache, dataFlowInfoForArguments, callResolverExtension, resolvedCalls,
|
resolutionResultsCache, dataFlowInfoForArguments, callChecker, resolvedCalls,
|
||||||
isAnnotationContext, collectAllCandidates);
|
isAnnotationContext, collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -437,8 +437,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
trace.record(RESOLVED_CALL, call, resolvedCall);
|
trace.record(RESOLVED_CALL, call, resolvedCall);
|
||||||
trace.record(CALL, expression, call);
|
trace.record(CALL, expression, call);
|
||||||
|
|
||||||
context.callResolverExtension.run(resolvedCall,
|
context.callChecker.check(resolvedCall,
|
||||||
BasicCallResolutionContext.create(context, call, CheckValueArgumentsMode.DISABLED));
|
BasicCallResolutionContext.create(context, call, CheckValueArgumentsMode.DISABLED));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isDeclaredInClass(ReceiverParameterDescriptor receiver) {
|
private static boolean isDeclaredInClass(ReceiverParameterDescriptor receiver) {
|
||||||
|
|||||||
+7
-7
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.resolve.calls.context.ContextDependency;
|
|||||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
|
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionResultsCache;
|
import org.jetbrains.kotlin.resolve.calls.context.ResolutionResultsCache;
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionResultsCacheImpl;
|
import org.jetbrains.kotlin.resolve.calls.context.ResolutionResultsCacheImpl;
|
||||||
import org.jetbrains.kotlin.resolve.calls.extensions.CallResolverExtension;
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstantChecker;
|
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstantChecker;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||||
@@ -47,7 +47,7 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
|
|||||||
public static ExpressionTypingContext newContext(@NotNull ResolutionContext context) {
|
public static ExpressionTypingContext newContext(@NotNull ResolutionContext context) {
|
||||||
return new ExpressionTypingContext(
|
return new ExpressionTypingContext(
|
||||||
context.trace, context.scope, context.dataFlowInfo, context.expectedType,
|
context.trace, context.scope, context.dataFlowInfo, context.expectedType,
|
||||||
context.contextDependency, context.resolutionResultsCache, context.callResolverExtension, context.isAnnotationContext,
|
context.contextDependency, context.resolutionResultsCache, context.callChecker, context.isAnnotationContext,
|
||||||
context.collectAllCandidates
|
context.collectAllCandidates
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -60,12 +60,12 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
|
|||||||
@NotNull JetType expectedType,
|
@NotNull JetType expectedType,
|
||||||
@NotNull ContextDependency contextDependency,
|
@NotNull ContextDependency contextDependency,
|
||||||
@NotNull ResolutionResultsCache resolutionResultsCache,
|
@NotNull ResolutionResultsCache resolutionResultsCache,
|
||||||
@NotNull CallResolverExtension callResolverExtension,
|
@NotNull CallChecker callChecker,
|
||||||
boolean isAnnotationContext
|
boolean isAnnotationContext
|
||||||
) {
|
) {
|
||||||
return new ExpressionTypingContext(
|
return new ExpressionTypingContext(
|
||||||
trace, scope, dataFlowInfo, expectedType, contextDependency,
|
trace, scope, dataFlowInfo, expectedType, contextDependency,
|
||||||
resolutionResultsCache, callResolverExtension, isAnnotationContext, false);
|
resolutionResultsCache, callChecker, isAnnotationContext, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompileTimeConstantChecker compileTimeConstantChecker;
|
private CompileTimeConstantChecker compileTimeConstantChecker;
|
||||||
@@ -77,11 +77,11 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
|
|||||||
@NotNull JetType expectedType,
|
@NotNull JetType expectedType,
|
||||||
@NotNull ContextDependency contextDependency,
|
@NotNull ContextDependency contextDependency,
|
||||||
@NotNull ResolutionResultsCache resolutionResultsCache,
|
@NotNull ResolutionResultsCache resolutionResultsCache,
|
||||||
@NotNull CallResolverExtension callResolverExtension,
|
@NotNull CallChecker callChecker,
|
||||||
boolean isAnnotationContext,
|
boolean isAnnotationContext,
|
||||||
boolean collectAllCandidates
|
boolean collectAllCandidates
|
||||||
) {
|
) {
|
||||||
super(trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache, callResolverExtension,
|
super(trace, scope, expectedType, dataFlowInfo, contextDependency, resolutionResultsCache, callChecker,
|
||||||
isAnnotationContext, collectAllCandidates);
|
isAnnotationContext, collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public class ExpressionTypingContext extends ResolutionContext<ExpressionTypingC
|
|||||||
boolean collectAllCandidates
|
boolean collectAllCandidates
|
||||||
) {
|
) {
|
||||||
return new ExpressionTypingContext(trace, scope, dataFlowInfo,
|
return new ExpressionTypingContext(trace, scope, dataFlowInfo,
|
||||||
expectedType, contextDependency, resolutionResultsCache, callResolverExtension,
|
expectedType, contextDependency, resolutionResultsCache, callChecker,
|
||||||
isAnnotationContext, collectAllCandidates);
|
isAnnotationContext, collectAllCandidates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -36,8 +36,8 @@ import org.jetbrains.kotlin.resolve.calls.CallExpressionResolver;
|
|||||||
import org.jetbrains.kotlin.resolve.calls.CallResolver;
|
import org.jetbrains.kotlin.resolve.calls.CallResolver;
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency;
|
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency;
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
|
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
|
||||||
import org.jetbrains.kotlin.resolve.calls.extensions.CallResolverExtension;
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
|
||||||
import org.jetbrains.kotlin.resolve.calls.extensions.CallResolverExtensionProvider;
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallResolverExtensionProvider;
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||||
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
|
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||||
@@ -361,7 +361,7 @@ public class ExpressionTypingServices {
|
|||||||
private ExpressionTypingContext createContext(ExpressionTypingContext oldContext, BindingTrace trace, WritableScope scope, DataFlowInfo dataFlowInfo, JetType expectedType) {
|
private ExpressionTypingContext createContext(ExpressionTypingContext oldContext, BindingTrace trace, WritableScope scope, DataFlowInfo dataFlowInfo, JetType expectedType) {
|
||||||
return ExpressionTypingContext.newContext(
|
return ExpressionTypingContext.newContext(
|
||||||
trace, scope, dataFlowInfo, expectedType, oldContext.contextDependency, oldContext.resolutionResultsCache,
|
trace, scope, dataFlowInfo, expectedType, oldContext.contextDependency, oldContext.resolutionResultsCache,
|
||||||
oldContext.callResolverExtension, oldContext.isAnnotationContext);
|
oldContext.callChecker, oldContext.isAnnotationContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -417,7 +417,7 @@ public class ExpressionTypingServices {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public CallResolverExtension createExtension(@NotNull JetScope scope, boolean isAnnotationContext) {
|
public CallChecker createExtension(@NotNull JetScope scope, boolean isAnnotationContext) {
|
||||||
return extensionProvider.createExtension(scope == JetScope.Empty.INSTANCE$ ? null : scope.getContainingDeclaration(), isAnnotationContext);
|
return extensionProvider.createExtension(scope == JetScope.Empty.INSTANCE$ ? null : scope.getContainingDeclaration(), isAnnotationContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
|||||||
import org.jetbrains.kotlin.resolve.calls.util.CallMaker
|
import org.jetbrains.kotlin.resolve.calls.util.CallMaker
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency
|
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.CheckValueArgumentsMode
|
import org.jetbrains.kotlin.resolve.calls.context.CheckValueArgumentsMode
|
||||||
import org.jetbrains.kotlin.resolve.calls.extensions.CompositeExtension
|
import org.jetbrains.kotlin.resolve.calls.checkers.CompositeChecker
|
||||||
import org.jetbrains.kotlin.di.InjectorForMacros
|
import org.jetbrains.kotlin.di.InjectorForMacros
|
||||||
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults
|
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
@@ -171,7 +171,7 @@ class ExpectedInfos(val bindingContext: BindingContext, val resolutionFacade: Re
|
|||||||
dataFlowInfo,
|
dataFlowInfo,
|
||||||
ContextDependency.INDEPENDENT,
|
ContextDependency.INDEPENDENT,
|
||||||
CheckValueArgumentsMode.ENABLED,
|
CheckValueArgumentsMode.ENABLED,
|
||||||
CompositeExtension(listOf()),
|
CompositeChecker(listOf()),
|
||||||
false).replaceCollectAllCandidates(true)
|
false).replaceCollectAllCandidates(true)
|
||||||
val callResolver = InjectorForMacros(
|
val callResolver = InjectorForMacros(
|
||||||
callElement.getProject(),
|
callElement.getProject(),
|
||||||
|
|||||||
Reference in New Issue
Block a user