Don't write "ResolvedCall<? extends CallableDescriptor>"
ResolvedCall has a type parameter D which extends CallableDescriptor. Hence in Java "ResolvedCall<? extends CallableDescriptor>" = "ResolvedCall<?>" The same story with these classes: - ResolutionTask - CallCandidateResolutionContext - OverloadResolutionResults
This commit is contained in:
@@ -86,8 +86,7 @@ public abstract class AnnotationCodegen {
|
||||
|
||||
List<JetAnnotationEntry> annotationEntries = modifierList.getAnnotationEntries();
|
||||
for (JetAnnotationEntry annotationEntry : annotationEntries) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
bindingContext.get(BindingContext.RESOLVED_CALL, annotationEntry.getCalleeExpression());
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, annotationEntry.getCalleeExpression());
|
||||
if (resolvedCall == null) continue; // Skipping annotations if they are not resolved. Needed for JetLightClass generation
|
||||
|
||||
AnnotationDescriptor annotationDescriptor = bindingContext.get(BindingContext.ANNOTATION, annotationEntry);
|
||||
|
||||
@@ -464,7 +464,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
// Is it a "1..2" or so
|
||||
RangeCodegenUtil.BinaryCall binaryCall = RangeCodegenUtil.getRangeAsBinaryCall(forExpression);
|
||||
if (binaryCall != null) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(RESOLVED_CALL, binaryCall.op);
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(RESOLVED_CALL, binaryCall.op);
|
||||
if (resolvedCall != null) {
|
||||
if (RangeCodegenUtil.isOptimizableRangeTo(resolvedCall.getResultingDescriptor())) {
|
||||
generateForLoop(new ForInRangeLiteralLoopGenerator(forExpression, binaryCall));
|
||||
@@ -1625,7 +1625,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
@Override
|
||||
public StackValue visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression, StackValue receiver) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression);
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression);
|
||||
|
||||
DeclarationDescriptor descriptor;
|
||||
if (resolvedCall == null) {
|
||||
@@ -1894,7 +1894,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
JetExpression callee = expression.getCalleeExpression();
|
||||
assert callee != null;
|
||||
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, callee);
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, callee);
|
||||
if (resolvedCall == null) {
|
||||
throw new CompilationException("Cannot resolve: " + callee.getText(), null, expression);
|
||||
}
|
||||
@@ -1922,11 +1922,8 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
return invokeFunction(call, receiver, resolvedCall);
|
||||
}
|
||||
|
||||
private StackValue invokeSamConstructor(
|
||||
JetCallExpression expression,
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall,
|
||||
JavaClassDescriptor samInterface
|
||||
) {
|
||||
@NotNull
|
||||
private StackValue invokeSamConstructor(JetCallExpression expression, ResolvedCall<?> resolvedCall, JavaClassDescriptor samInterface) {
|
||||
List<ResolvedValueArgument> arguments = resolvedCall.getValueArgumentsByIndex();
|
||||
if (arguments == null) {
|
||||
throw new IllegalStateException("Failed to arrange value arguments by index: " + resolvedCall.getResultingDescriptor());
|
||||
@@ -1994,11 +1991,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public StackValue invokeFunction(
|
||||
Call call,
|
||||
StackValue receiver,
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall
|
||||
) {
|
||||
public StackValue invokeFunction(Call call, StackValue receiver, ResolvedCall<?> resolvedCall) {
|
||||
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
return invokeFunction(call, receiver, ((VariableAsFunctionResolvedCall) resolvedCall).getFunctionCall());
|
||||
}
|
||||
@@ -2034,7 +2027,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
private StackValue invokeFunctionWithCalleeOnStack(
|
||||
@NotNull Call call,
|
||||
@NotNull StackValue receiver,
|
||||
@NotNull ResolvedCall<? extends CallableDescriptor> resolvedCall,
|
||||
@NotNull ResolvedCall<?> resolvedCall,
|
||||
@NotNull Callable callable
|
||||
) {
|
||||
if (callable instanceof CallableMethod) {
|
||||
@@ -2118,7 +2111,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
public void invokeMethodWithArguments(
|
||||
@Nullable Call call,
|
||||
@NotNull CallableMethod callableMethod,
|
||||
@NotNull ResolvedCall<? extends CallableDescriptor> resolvedCall,
|
||||
@NotNull ResolvedCall<?> resolvedCall,
|
||||
@NotNull StackValue receiver
|
||||
) {
|
||||
CallableDescriptor descriptor = resolvedCall.getResultingDescriptor();
|
||||
@@ -2159,11 +2152,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
callGenerator.genCall(callable, resolvedCall, mask, this);
|
||||
}
|
||||
|
||||
private void genThisAndReceiverFromResolvedCall(
|
||||
StackValue receiver,
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall,
|
||||
CallableMethod callableMethod
|
||||
) {
|
||||
private void genThisAndReceiverFromResolvedCall(StackValue receiver, ResolvedCall<?> resolvedCall, CallableMethod callableMethod) {
|
||||
receiver = StackValue.receiver(resolvedCall, receiver, this, callableMethod);
|
||||
receiver.put(receiver.type, v);
|
||||
}
|
||||
@@ -2461,7 +2450,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
FunctionDescriptor functionDescriptor = bindingContext.get(FUNCTION, expression);
|
||||
assert functionDescriptor != null : "Callable reference is not resolved to descriptor: " + expression.getText();
|
||||
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(RESOLVED_CALL, expression.getCallableReference());
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(RESOLVED_CALL, expression.getCallableReference());
|
||||
assert resolvedCall != null : "Callable reference is not resolved: " + functionDescriptor + " " + expression.getText();
|
||||
|
||||
JetType kFunctionType = bindingContext.get(EXPRESSION_TYPE, expression);
|
||||
@@ -2482,13 +2471,13 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
}
|
||||
|
||||
private static class CallableReferenceGenerationStrategy extends FunctionGenerationStrategy.CodegenBased<FunctionDescriptor> {
|
||||
private final ResolvedCall<? extends CallableDescriptor> resolvedCall;
|
||||
private final ResolvedCall<?> resolvedCall;
|
||||
private final FunctionDescriptor referencedFunction;
|
||||
|
||||
public CallableReferenceGenerationStrategy(
|
||||
@NotNull GenerationState state,
|
||||
@NotNull FunctionDescriptor functionDescriptor,
|
||||
@NotNull ResolvedCall<? extends CallableDescriptor> resolvedCall
|
||||
@NotNull ResolvedCall<?> resolvedCall
|
||||
) {
|
||||
super(state, functionDescriptor);
|
||||
this.resolvedCall = resolvedCall;
|
||||
@@ -2704,7 +2693,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
return generateIn(StackValue.expression(Type.INT_TYPE, expression.getLeft(), this), expression.getRight(), reference);
|
||||
}
|
||||
else {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, reference);
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, reference);
|
||||
Call call = bindingContext.get(BindingContext.CALL, reference);
|
||||
|
||||
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, reference);
|
||||
@@ -2912,8 +2901,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
gen(right, type);
|
||||
}
|
||||
else {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
bindingContext.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
|
||||
Call call = bindingContext.get(BindingContext.CALL, expression.getOperationReference());
|
||||
StackValue result = invokeFunction(call, receiver, resolvedCall);
|
||||
type = Type.INT_TYPE;
|
||||
@@ -2975,8 +2963,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
private void callAugAssignMethod(JetBinaryExpression expression, CallableMethod callable, Type lhsType, boolean keepReturnValue) {
|
||||
JetSimpleNameExpression reference = expression.getOperationReference();
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
bindingContext.get(BindingContext.RESOLVED_CALL, reference);
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, reference);
|
||||
Call call = bindingContext.get(BindingContext.CALL, reference);
|
||||
|
||||
assert resolvedCall != null : "Resolved call should be not null for operation reference in " + expression.getText();
|
||||
@@ -3047,8 +3034,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
}
|
||||
|
||||
DeclarationDescriptor cls = op.getContainingDeclaration();
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
bindingContext.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
|
||||
assert resolvedCall != null;
|
||||
|
||||
if (isPrimitiveNumberClassDescriptor(cls) || !(op.getName().asString().equals("inc") || op.getName().asString().equals("dec"))) {
|
||||
@@ -3131,7 +3117,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
storeType = type;
|
||||
}
|
||||
else {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
|
||||
assert resolvedCall != null;
|
||||
Callable callable = resolveToCallable((FunctionDescriptor) op, false);
|
||||
CallableMethod callableMethod = (CallableMethod) callable;
|
||||
@@ -3273,7 +3259,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
@NotNull
|
||||
private StackValue generateNewCall(
|
||||
@NotNull JetCallExpression expression,
|
||||
@NotNull ResolvedCall<? extends CallableDescriptor> resolvedCall,
|
||||
@NotNull ResolvedCall<?> resolvedCall,
|
||||
@NotNull StackValue receiver
|
||||
) {
|
||||
Type type = expressionType(expression);
|
||||
@@ -3286,11 +3272,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StackValue generateConstructorCall(
|
||||
@NotNull ResolvedCall<? extends CallableDescriptor> resolvedCall,
|
||||
@NotNull StackValue receiver,
|
||||
@NotNull Type type
|
||||
) {
|
||||
private StackValue generateConstructorCall(@NotNull ResolvedCall<?> resolvedCall, @NotNull StackValue receiver, @NotNull Type type) {
|
||||
v.anew(type);
|
||||
v.dup();
|
||||
|
||||
@@ -3805,8 +3787,7 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
}
|
||||
|
||||
private void invokeFunctionByReference(JetSimpleNameExpression operationReference) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
bindingContext.get(RESOLVED_CALL, operationReference);
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(RESOLVED_CALL, operationReference);
|
||||
Call call = bindingContext.get(CALL, operationReference);
|
||||
invokeFunction(call, StackValue.none(), resolvedCall);
|
||||
}
|
||||
|
||||
@@ -1322,7 +1322,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
JetExpression expression = ((JetDelegatorByExpressionSpecifier) specifier).getDelegateExpression();
|
||||
PropertyDescriptor propertyDescriptor = null;
|
||||
if (expression instanceof JetSimpleNameExpression) {
|
||||
ResolvedCall<? extends CallableDescriptor> call = bindingContext.get(BindingContext.RESOLVED_CALL, expression);
|
||||
ResolvedCall<?> call = bindingContext.get(BindingContext.RESOLVED_CALL, expression);
|
||||
if (call != null) {
|
||||
CallableDescriptor callResultingDescriptor = call.getResultingDescriptor();
|
||||
if (callResultingDescriptor instanceof ValueParameterDescriptor) {
|
||||
@@ -1549,8 +1549,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
CallableMethod method = typeMapper.mapToCallableMethod(constructorDescriptor);
|
||||
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
bindingContext.get(BindingContext.RESOLVED_CALL, ((JetCallElement) superCall).getCalleeExpression());
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, ((JetCallElement) superCall).getCalleeExpression());
|
||||
assert resolvedCall != null;
|
||||
ConstructorDescriptor superConstructor = (ConstructorDescriptor) resolvedCall.getResultingDescriptor();
|
||||
|
||||
@@ -1651,7 +1650,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
throw new UnsupportedOperationException("unsupported type of enum constant initializer: " + specifier);
|
||||
}
|
||||
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
ResolvedCall<?> resolvedCall =
|
||||
bindingContext.get(BindingContext.RESOLVED_CALL, ((JetDelegatorToSuperCall) specifier).getCalleeExpression());
|
||||
assert resolvedCall != null : "Enum entry delegation specifier is unresolved: " + specifier.getText();
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.asm4.Label;
|
||||
import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.asm4.commons.InstructionAdapter;
|
||||
import org.jetbrains.asm4.commons.Method;
|
||||
import org.jetbrains.asm4.tree.MethodNode;
|
||||
import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethod;
|
||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
||||
@@ -326,7 +325,7 @@ public abstract class StackValue {
|
||||
}
|
||||
|
||||
public static StackValue receiver(
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall,
|
||||
ResolvedCall<?> resolvedCall,
|
||||
StackValue receiver,
|
||||
ExpressionCodegen codegen,
|
||||
@Nullable CallableMethod callableMethod
|
||||
@@ -775,7 +774,7 @@ public abstract class StackValue {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isStandardStack(ResolvedCall call, int valueParamsSize) {
|
||||
private boolean isStandardStack(ResolvedCall<?> call, int valueParamsSize) {
|
||||
if (call == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -1099,14 +1098,14 @@ public abstract class StackValue {
|
||||
}
|
||||
|
||||
public static class CallReceiver extends StackValue {
|
||||
private final ResolvedCall<? extends CallableDescriptor> resolvedCall;
|
||||
private final ResolvedCall<?> resolvedCall;
|
||||
final StackValue receiver;
|
||||
private final ExpressionCodegen codegen;
|
||||
private final CallableMethod callableMethod;
|
||||
private final boolean putReceiverArgumentOnStack;
|
||||
|
||||
public CallReceiver(
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall,
|
||||
ResolvedCall<?> resolvedCall,
|
||||
StackValue receiver,
|
||||
ExpressionCodegen codegen,
|
||||
CallableMethod callableMethod,
|
||||
@@ -1120,11 +1119,7 @@ public abstract class StackValue {
|
||||
this.putReceiverArgumentOnStack = putReceiverArgumentOnStack;
|
||||
}
|
||||
|
||||
private static Type calcType(
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall,
|
||||
ExpressionCodegen codegen,
|
||||
CallableMethod callableMethod
|
||||
) {
|
||||
private static Type calcType(ResolvedCall<?> resolvedCall, ExpressionCodegen codegen, CallableMethod callableMethod) {
|
||||
ReceiverValue thisObject = resolvedCall.getThisObject();
|
||||
ReceiverValue receiverArgument = resolvedCall.getReceiverArgument();
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class TailRecursionCodegen {
|
||||
return status != null && status.isDoGenerateTailRecursion();
|
||||
}
|
||||
|
||||
public void generateTailRecursion(ResolvedCall<? extends CallableDescriptor> resolvedCall) {
|
||||
public void generateTailRecursion(ResolvedCall<?> resolvedCall) {
|
||||
CallableDescriptor fd = resolvedCall.getResultingDescriptor();
|
||||
assert fd instanceof FunctionDescriptor : "Resolved call doesn't refer to the function descriptor: " + fd;
|
||||
CallableMethod callable = (CallableMethod) codegen.resolveToCallable((FunctionDescriptor) fd, false);
|
||||
@@ -107,7 +107,7 @@ public class TailRecursionCodegen {
|
||||
JetExpression argumentExpression = argument == null ? null : argument.getArgumentExpression();
|
||||
|
||||
if (argumentExpression instanceof JetSimpleNameExpression) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = state.getBindingContext().get(RESOLVED_CALL, argumentExpression);
|
||||
ResolvedCall<?> resolvedCall = state.getBindingContext().get(RESOLVED_CALL, argumentExpression);
|
||||
if (resolvedCall != null && resolvedCall.getResultingDescriptor().equals(parameterDescriptor.getOriginal())) {
|
||||
// do nothing: we shouldn't store argument to itself again
|
||||
AsmUtil.pop(v, type);
|
||||
|
||||
+2
-3
@@ -314,8 +314,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
// working around a problem with shallow analysis
|
||||
if (functionDescriptor == null) return;
|
||||
|
||||
ResolvedCall<? extends CallableDescriptor> referencedFunction =
|
||||
bindingContext.get(RESOLVED_CALL, expression.getCallableReference());
|
||||
ResolvedCall<?> referencedFunction = bindingContext.get(RESOLVED_CALL, expression.getCallableReference());
|
||||
if (referencedFunction == null) return;
|
||||
JetType superType = getSuperTypeForClosure((FunctionDescriptor) referencedFunction.getResultingDescriptor(), true);
|
||||
|
||||
@@ -406,7 +405,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
@Override
|
||||
public void visitCallExpression(@NotNull JetCallExpression expression) {
|
||||
super.visitCallExpression(expression);
|
||||
ResolvedCall<? extends CallableDescriptor> call = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getCalleeExpression());
|
||||
ResolvedCall<?> call = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getCalleeExpression());
|
||||
if (call == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.asm4.commons.InstructionAdapter;
|
||||
import org.jetbrains.jet.codegen.ExpressionCodegen;
|
||||
import org.jetbrains.jet.codegen.StackValue;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetCallExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
@@ -46,7 +45,7 @@ public class JavaClassArray extends IntrinsicMethod {
|
||||
@Nullable List<JetExpression> arguments,
|
||||
StackValue receiver
|
||||
) {
|
||||
ResolvedCall<? extends CallableDescriptor> call =
|
||||
ResolvedCall<?> call =
|
||||
codegen.getBindingContext().get(BindingContext.RESOLVED_CALL, ((JetCallExpression) element).getCalleeExpression());
|
||||
assert call != null;
|
||||
Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> next = call.getValueArguments().entrySet().iterator().next();
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.asm4.commons.InstructionAdapter;
|
||||
import org.jetbrains.jet.codegen.ExpressionCodegen;
|
||||
import org.jetbrains.jet.codegen.StackValue;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetCallExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
@@ -48,8 +47,7 @@ public class JavaClassFunction extends IntrinsicMethod {
|
||||
StackValue receiver
|
||||
) {
|
||||
JetCallExpression call = (JetCallExpression) element;
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
codegen.getBindingContext().get(BindingContext.RESOLVED_CALL, call.getCalleeExpression());
|
||||
ResolvedCall<?> resolvedCall = codegen.getBindingContext().get(BindingContext.RESOLVED_CALL, call.getCalleeExpression());
|
||||
assert resolvedCall != null;
|
||||
JetType returnType = resolvedCall.getResultingDescriptor().getReturnType();
|
||||
assert returnType != null;
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.asm4.commons.InstructionAdapter;
|
||||
import org.jetbrains.jet.codegen.ExpressionCodegen;
|
||||
import org.jetbrains.jet.codegen.StackValue;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetCallExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
@@ -47,7 +46,7 @@ public class StupidSync extends IntrinsicMethod {
|
||||
StackValue receiver
|
||||
) {
|
||||
assert element != null : "Element should not be null";
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
ResolvedCall<?> resolvedCall =
|
||||
codegen.getBindingContext().get(BindingContext.RESOLVED_CALL, ((JetCallExpression) element).getCalleeExpression());
|
||||
|
||||
assert resolvedCall != null : "Resolved call for " + element.getText() + " should be not null";
|
||||
|
||||
@@ -377,7 +377,7 @@ public interface Errors {
|
||||
|
||||
DiagnosticFactory0<JetMultiDeclaration> INITIALIZER_REQUIRED_FOR_MULTIDECLARATION = DiagnosticFactory0.create(ERROR, DEFAULT);
|
||||
DiagnosticFactory2<JetExpression, Name, JetType> COMPONENT_FUNCTION_MISSING = DiagnosticFactory2.create(ERROR, DEFAULT);
|
||||
DiagnosticFactory2<JetExpression, Name, Collection<? extends ResolvedCall<? extends CallableDescriptor>>> COMPONENT_FUNCTION_AMBIGUITY = DiagnosticFactory2.create(ERROR, DEFAULT);
|
||||
DiagnosticFactory2<JetExpression, Name, Collection<? extends ResolvedCall<?>>> COMPONENT_FUNCTION_AMBIGUITY = DiagnosticFactory2.create(ERROR, DEFAULT);
|
||||
DiagnosticFactory3<JetExpression, Name, JetType, JetType> COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH = DiagnosticFactory3.create(ERROR, DEFAULT);
|
||||
|
||||
// Super calls
|
||||
|
||||
@@ -106,12 +106,12 @@ public class Renderers {
|
||||
};
|
||||
|
||||
public static final Renderer<Collection<? extends ResolvedCall<?>>> AMBIGUOUS_CALLS =
|
||||
new Renderer<Collection<? extends ResolvedCall<? extends CallableDescriptor>>>() {
|
||||
new Renderer<Collection<? extends ResolvedCall<?>>>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String render(@NotNull Collection<? extends ResolvedCall<? extends CallableDescriptor>> argument) {
|
||||
public String render(@NotNull Collection<? extends ResolvedCall<?>> argument) {
|
||||
StringBuilder stringBuilder = new StringBuilder("\n");
|
||||
for (ResolvedCall<? extends CallableDescriptor> call : argument) {
|
||||
for (ResolvedCall<?> call : argument) {
|
||||
stringBuilder.append(DescriptorRenderer.TEXT.render(call.getResultingDescriptor())).append("\n");
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
|
||||
@@ -208,11 +208,10 @@ public class AnnotationResolver {
|
||||
|
||||
public static void resolveAnnotationArgument(
|
||||
@NotNull AnnotationDescriptorImpl annotationDescriptor,
|
||||
@NotNull ResolvedCall<? extends CallableDescriptor> call,
|
||||
@NotNull ResolvedCall<?> resolvedCall,
|
||||
@NotNull BindingTrace trace
|
||||
) {
|
||||
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> descriptorToArgument :
|
||||
call.getValueArguments().entrySet()) {
|
||||
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> descriptorToArgument : resolvedCall.getValueArguments().entrySet()) {
|
||||
ValueParameterDescriptor parameterDescriptor = descriptorToArgument.getKey();
|
||||
|
||||
JetType varargElementType = parameterDescriptor.getVarargElementType();
|
||||
|
||||
@@ -88,8 +88,7 @@ public interface BindingContext {
|
||||
new BasicWritableSlice<JetReferenceExpression, DeclarationDescriptor>(DO_NOTHING);
|
||||
|
||||
@KotlinSignature("val RESOLVED_CALL: WritableSlice<JetElement, ResolvedCall<out CallableDescriptor>>")
|
||||
WritableSlice<JetElement, ResolvedCall<? extends CallableDescriptor>> RESOLVED_CALL =
|
||||
new BasicWritableSlice<JetElement, ResolvedCall<? extends CallableDescriptor>>(DO_NOTHING);
|
||||
WritableSlice<JetElement, ResolvedCall<?>> RESOLVED_CALL = new BasicWritableSlice<JetElement, ResolvedCall<?>>(DO_NOTHING);
|
||||
WritableSlice<ResolvedCall<?>, TailRecursionKind> TAIL_RECURSION_CALL = Slices.createSimpleSlice();
|
||||
WritableSlice<JetElement, ConstraintSystemCompleter> CONSTRAINT_SYSTEM_COMPLETER = new BasicWritableSlice<JetElement, ConstraintSystemCompleter>(DO_NOTHING);
|
||||
WritableSlice<JetElement, Call> CALL = new BasicWritableSlice<JetElement, Call>(DO_NOTHING);
|
||||
|
||||
@@ -39,9 +39,7 @@ import java.util.*;
|
||||
|
||||
import static org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor.Kind.*;
|
||||
import static org.jetbrains.jet.lang.diagnostics.Errors.AMBIGUOUS_LABEL;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.AMBIGUOUS_LABEL_TARGET;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.CAPTURED_IN_CLOSURE;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.DECLARATION_TO_DESCRIPTOR;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
|
||||
|
||||
public class BindingContextUtils {
|
||||
private BindingContextUtils() {
|
||||
@@ -302,7 +300,7 @@ public class BindingContextUtils {
|
||||
) {
|
||||
if (expression instanceof JetCallExpression) {
|
||||
JetExpression calleeExpression = ((JetCallExpression) expression).getCalleeExpression();
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = context.get(BindingContext.RESOLVED_CALL, calleeExpression);
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, calleeExpression);
|
||||
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -112,11 +112,11 @@ public class CompileTimeConstantUtils {
|
||||
return value instanceof String ? (String) value : null;
|
||||
}
|
||||
|
||||
public static boolean isArrayMethodCall(@NotNull ResolvedCall resolvedCall) {
|
||||
public static boolean isArrayMethodCall(@NotNull ResolvedCall<?> resolvedCall) {
|
||||
return "kotlin.arrays.array".equals(getIntrinsicAnnotationArgument(resolvedCall.getResultingDescriptor().getOriginal()));
|
||||
}
|
||||
|
||||
public static boolean isJavaClassMethodCall(@NotNull ResolvedCall resolvedCall) {
|
||||
public static boolean isJavaClassMethodCall(@NotNull ResolvedCall<?> resolvedCall) {
|
||||
return "kotlin.javaClass.function".equals(getIntrinsicAnnotationArgument(resolvedCall.getResultingDescriptor().getOriginal()));
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -399,8 +399,12 @@ public class CallExpressionResolver {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void checkSuper(@NotNull ReceiverValue receiverValue, @NotNull OverloadResolutionResults<? extends CallableDescriptor> results,
|
||||
@NotNull BindingTrace trace, @NotNull JetExpression expression) {
|
||||
private static void checkSuper(
|
||||
@NotNull ReceiverValue receiverValue,
|
||||
@NotNull OverloadResolutionResults<?> results,
|
||||
@NotNull BindingTrace trace,
|
||||
@NotNull JetExpression expression
|
||||
) {
|
||||
if (!results.isSingleResult()) return;
|
||||
if (!(receiverValue instanceof ExpressionReceiver)) return;
|
||||
JetExpression receiver = ((ExpressionReceiver) receiverValue).getExpression();
|
||||
|
||||
@@ -27,7 +27,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.AutoCastUtils;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowValue;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowValueFactory;
|
||||
import org.jetbrains.jet.lang.resolve.calls.context.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.inference.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.*;
|
||||
@@ -347,8 +350,7 @@ public class CandidateResolver {
|
||||
context = context.replaceExpectedType(expectedType);
|
||||
|
||||
JetExpression keyExpression = getDeferredComputationKeyExpression(expression);
|
||||
CallCandidateResolutionContext<? extends CallableDescriptor> storedContextForArgument =
|
||||
context.resolutionResultsCache.getDeferredComputation(keyExpression);
|
||||
CallCandidateResolutionContext<?> storedContextForArgument = context.resolutionResultsCache.getDeferredComputation(keyExpression);
|
||||
|
||||
PsiElement parent = expression.getParent();
|
||||
if (parent instanceof JetWhenExpression && expression == ((JetWhenExpression) parent).getSubjectExpression()
|
||||
@@ -361,7 +363,7 @@ public class CandidateResolver {
|
||||
return;
|
||||
}
|
||||
|
||||
CallCandidateResolutionContext<? extends CallableDescriptor> contextForArgument = storedContextForArgument
|
||||
CallCandidateResolutionContext<?> contextForArgument = storedContextForArgument
|
||||
.replaceContextDependency(INDEPENDENT).replaceBindingTrace(context.trace).replaceExpectedType(expectedType);
|
||||
JetType type;
|
||||
if (contextForArgument.candidateCall.hasIncompleteTypeParameters()
|
||||
@@ -405,32 +407,27 @@ public class CandidateResolver {
|
||||
JetExpression keyExpression = getDeferredComputationKeyExpression(expression);
|
||||
markResultingCallAsCompleted(context, keyExpression);
|
||||
|
||||
CallCandidateResolutionContext<? extends CallableDescriptor> storedContextForArgument =
|
||||
CallCandidateResolutionContext<?> storedContextForArgument =
|
||||
context.resolutionResultsCache.getDeferredComputation(keyExpression);
|
||||
if (storedContextForArgument != null) {
|
||||
completeNestedCallsForNotResolvedInvocation(storedContextForArgument);
|
||||
CallCandidateResolutionContext<? extends CallableDescriptor> newContext =
|
||||
storedContextForArgument.replaceBindingTrace(context.trace);
|
||||
CallCandidateResolutionContext<?> newContext = storedContextForArgument.replaceBindingTrace(context.trace);
|
||||
completeUnmappedArguments(newContext, storedContextForArgument.candidateCall.getUnmappedArguments());
|
||||
argumentTypeResolver.checkTypesForFunctionArgumentsWithNoCallee(newContext.replaceContextDependency(INDEPENDENT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void markResultingCallAsCompleted(
|
||||
@NotNull CallResolutionContext<?> context,
|
||||
@Nullable JetExpression keyExpression
|
||||
) {
|
||||
private static void markResultingCallAsCompleted(@NotNull CallResolutionContext<?> context, @Nullable JetExpression keyExpression) {
|
||||
if (keyExpression == null) return;
|
||||
|
||||
CallCandidateResolutionContext<? extends CallableDescriptor> storedContextForArgument =
|
||||
context.resolutionResultsCache.getDeferredComputation(keyExpression);
|
||||
CallCandidateResolutionContext<?> storedContextForArgument = context.resolutionResultsCache.getDeferredComputation(keyExpression);
|
||||
if (storedContextForArgument == null) return;
|
||||
|
||||
storedContextForArgument.candidateCall.markCallAsCompleted();
|
||||
|
||||
// clean data for "invoke" calls
|
||||
ResolvedCallWithTrace<? extends CallableDescriptor> resolvedCall = context.resolutionResultsCache.getCallForArgument(keyExpression);
|
||||
ResolvedCallWithTrace<?> resolvedCall = context.resolutionResultsCache.getCallForArgument(keyExpression);
|
||||
assert resolvedCall != null : "Resolved call for '" + keyExpression + "' is not stored, but CallCandidateResolutionContext is.";
|
||||
resolvedCall.markCallAsCompleted();
|
||||
}
|
||||
|
||||
+2
-4
@@ -70,9 +70,7 @@ public class InlineCallResolverExtension implements CallResolverExtension {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <F extends CallableDescriptor> void run(
|
||||
@NotNull ResolvedCall<F> resolvedCall, @NotNull BasicCallResolutionContext context
|
||||
) {
|
||||
public <F extends CallableDescriptor> void run(@NotNull ResolvedCall<F> resolvedCall, @NotNull BasicCallResolutionContext context) {
|
||||
JetExpression expression = context.call.getCalleeExpression();
|
||||
if (expression == null) {
|
||||
return;
|
||||
@@ -186,7 +184,7 @@ public class InlineCallResolverExtension implements CallResolverExtension {
|
||||
@NotNull BasicCallResolutionContext context,
|
||||
@NotNull JetExpression expression
|
||||
) {
|
||||
ResolvedCall<? extends CallableDescriptor> thisCall = context.trace.get(BindingContext.RESOLVED_CALL, expression);
|
||||
ResolvedCall<?> thisCall = context.trace.get(BindingContext.RESOLVED_CALL, expression);
|
||||
return thisCall != null ? thisCall.getResultingDescriptor() : null;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -62,8 +62,8 @@ public interface ResolutionResultsCache {
|
||||
);
|
||||
|
||||
@Nullable
|
||||
CallCandidateResolutionContext<? extends CallableDescriptor> getDeferredComputation(@Nullable JetExpression expression);
|
||||
CallCandidateResolutionContext<?> getDeferredComputation(@Nullable JetExpression expression);
|
||||
|
||||
@Nullable
|
||||
ResolvedCallWithTrace<? extends CallableDescriptor> getCallForArgument(@Nullable JetExpression expression);
|
||||
ResolvedCallWithTrace<?> getCallForArgument(@Nullable JetExpression expression);
|
||||
}
|
||||
|
||||
+5
-6
@@ -36,12 +36,11 @@ import static org.jetbrains.jet.lang.psi.Call.CallType;
|
||||
import static org.jetbrains.jet.lang.psi.Call.CallType.*;
|
||||
|
||||
public class ResolutionResultsCacheImpl implements ResolutionResultsCache {
|
||||
public static final WritableSlice<CallKey, OverloadResolutionResultsImpl<FunctionDescriptor>>
|
||||
RESOLUTION_RESULTS_FOR_FUNCTION = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<CallKey, OverloadResolutionResultsImpl<FunctionDescriptor>> RESOLUTION_RESULTS_FOR_FUNCTION = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<CallKey, OverloadResolutionResultsImpl<VariableDescriptor>> RESOLUTION_RESULTS_FOR_PROPERTY = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<CallKey, DelegatingBindingTrace> TRACE_DELTAS_CACHE = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<CallKey, CallCandidateResolutionContext<? extends CallableDescriptor>> DEFERRED_COMPUTATION_FOR_CALL = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<CallKey, ResolvedCallWithTrace<? extends CallableDescriptor>> RESOLVED_CALL_FOR_ARGUMENT = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<CallKey, CallCandidateResolutionContext<?>> DEFERRED_COMPUTATION_FOR_CALL = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<CallKey, ResolvedCallWithTrace<?>> RESOLVED_CALL_FOR_ARGUMENT = Slices.createSimpleSlice();
|
||||
|
||||
static {
|
||||
BasicWritableSlice.initSliceDebugNames(ResolutionResultsCacheImpl.class);
|
||||
@@ -91,7 +90,7 @@ public class ResolutionResultsCacheImpl implements ResolutionResultsCache {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public CallCandidateResolutionContext<? extends CallableDescriptor> getDeferredComputation(@Nullable JetExpression expression) {
|
||||
public CallCandidateResolutionContext<?> getDeferredComputation(@Nullable JetExpression expression) {
|
||||
return getValueTryingAllCallTypes(expression, DEFERRED_COMPUTATION_FOR_CALL);
|
||||
}
|
||||
|
||||
@@ -113,7 +112,7 @@ public class ResolutionResultsCacheImpl implements ResolutionResultsCache {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResolvedCallWithTrace<? extends CallableDescriptor> getCallForArgument(@Nullable JetExpression expression) {
|
||||
public ResolvedCallWithTrace<?> getCallForArgument(@Nullable JetExpression expression) {
|
||||
return getValueTryingAllCallTypes(expression, RESOLVED_CALL_FOR_ARGUMENT);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -85,8 +85,8 @@ public class TemporaryResolutionResultsCache implements ResolutionResultsCache {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CallCandidateResolutionContext<? extends CallableDescriptor> getDeferredComputation(@Nullable JetExpression expression) {
|
||||
CallCandidateResolutionContext<? extends CallableDescriptor> computation = innerCache.getDeferredComputation(expression);
|
||||
public CallCandidateResolutionContext<?> getDeferredComputation(@Nullable JetExpression expression) {
|
||||
CallCandidateResolutionContext<?> computation = innerCache.getDeferredComputation(expression);
|
||||
if (computation != null) {
|
||||
return computation;
|
||||
}
|
||||
@@ -95,8 +95,8 @@ public class TemporaryResolutionResultsCache implements ResolutionResultsCache {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResolvedCallWithTrace<? extends CallableDescriptor> getCallForArgument(@Nullable JetExpression expression) {
|
||||
ResolvedCallWithTrace<? extends CallableDescriptor> resolvedCall = innerCache.getCallForArgument(expression);
|
||||
public ResolvedCallWithTrace<?> getCallForArgument(@Nullable JetExpression expression) {
|
||||
ResolvedCallWithTrace<?> resolvedCall = innerCache.getCallForArgument(expression);
|
||||
if (resolvedCall != null) {
|
||||
return resolvedCall;
|
||||
}
|
||||
|
||||
+4
-4
@@ -45,16 +45,16 @@ import static org.jetbrains.jet.lang.resolve.calls.results.ResolutionStatus.UNKN
|
||||
|
||||
public class ResolvedCallImpl<D extends CallableDescriptor> implements ResolvedCallWithTrace<D> {
|
||||
|
||||
public static final Function<ResolvedCallWithTrace<? extends CallableDescriptor>, CallableDescriptor> MAP_TO_CANDIDATE = new Function<ResolvedCallWithTrace<? extends CallableDescriptor>, CallableDescriptor>() {
|
||||
public static final Function<ResolvedCallWithTrace<?>, CallableDescriptor> MAP_TO_CANDIDATE = new Function<ResolvedCallWithTrace<?>, CallableDescriptor>() {
|
||||
@Override
|
||||
public CallableDescriptor fun(ResolvedCallWithTrace<? extends CallableDescriptor> resolvedCall) {
|
||||
public CallableDescriptor fun(ResolvedCallWithTrace<?> resolvedCall) {
|
||||
return resolvedCall.getCandidateDescriptor();
|
||||
}
|
||||
};
|
||||
|
||||
public static final Function<ResolvedCallWithTrace<? extends CallableDescriptor>, CallableDescriptor> MAP_TO_RESULT = new Function<ResolvedCallWithTrace<? extends CallableDescriptor>, CallableDescriptor>() {
|
||||
public static final Function<ResolvedCallWithTrace<?>, CallableDescriptor> MAP_TO_RESULT = new Function<ResolvedCallWithTrace<?>, CallableDescriptor>() {
|
||||
@Override
|
||||
public CallableDescriptor fun(ResolvedCallWithTrace<? extends CallableDescriptor> resolvedCall) {
|
||||
public CallableDescriptor fun(ResolvedCallWithTrace<?> resolvedCall) {
|
||||
return resolvedCall.getResultingDescriptor();
|
||||
}
|
||||
};
|
||||
|
||||
+6
-8
@@ -19,7 +19,6 @@ package org.jetbrains.jet.lang.resolve.calls.results;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.calls.inference.BoundsOwner;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||
@@ -27,18 +26,17 @@ import org.jetbrains.jet.lang.resolve.calls.tasks.ResolutionTask;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.util.slicedmap.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ResolutionDebugInfo {
|
||||
public static final WritableSlice<One, List<? extends ResolutionTask<? extends CallableDescriptor, ?>>> TASKS = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<One, ResolvedCall<? extends CallableDescriptor>> RESULT = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<One, List<? extends ResolutionTask<?, ?>>> TASKS = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<One, ResolvedCall<?>> RESULT = Slices.createSimpleSlice();
|
||||
|
||||
public static final WritableSlice<ResolvedCall<? extends CallableDescriptor>, StringBuilder> ERRORS = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<ResolvedCall<? extends CallableDescriptor>, StringBuilder> LOG = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<ResolvedCall<? extends CallableDescriptor>, Map<TypeParameterDescriptor, BoundsOwner>> BOUNDS_FOR_UNKNOWNS = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<ResolvedCall<? extends CallableDescriptor>, Map<JetType, BoundsOwner>> BOUNDS_FOR_KNOWNS = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<ResolvedCall<?>, StringBuilder> ERRORS = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<ResolvedCall<?>, StringBuilder> LOG = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<ResolvedCall<?>, Map<TypeParameterDescriptor, BoundsOwner>> BOUNDS_FOR_UNKNOWNS = Slices.createSimpleSlice();
|
||||
public static final WritableSlice<ResolvedCall<?>, Map<JetType, BoundsOwner>> BOUNDS_FOR_KNOWNS = Slices.createSimpleSlice();
|
||||
|
||||
public static boolean RESOLUTION_DEBUG_INFO_ENABLED = false;
|
||||
|
||||
|
||||
+3
-3
@@ -153,12 +153,12 @@ public class ExpressionTypingUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
ResolvedCall<? extends CallableDescriptor> call = context.get(BindingContext.RESOLVED_CALL, callExpression.getCalleeExpression());
|
||||
if (call == null) {
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, callExpression.getCalleeExpression());
|
||||
if (resolvedCall == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CallableDescriptor callable = call.getResultingDescriptor();
|
||||
CallableDescriptor callable = resolvedCall.getResultingDescriptor();
|
||||
if (callable instanceof SimpleFunctionDescriptor && ((SimpleFunctionDescriptor) callable).getInlineStrategy().isInline()) {
|
||||
DeclarationDescriptor scopeContainerParent = scopeContainer.getContainingDeclaration();
|
||||
assert scopeContainerParent != null : "parent is null for " + scopeContainer;
|
||||
|
||||
+2
-3
@@ -25,7 +25,6 @@ import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.Errors;
|
||||
import org.jetbrains.jet.lang.evaluate.EvaluatePackage;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||
@@ -273,8 +272,8 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
OverloadResolutionResults<FunctionDescriptor> ambiguityResolutionResults = OverloadResolutionResultsUtil.ambiguity(assignmentOperationDescriptors, binaryOperationDescriptors);
|
||||
context.trace.report(ASSIGN_OPERATOR_AMBIGUITY.on(operationSign, ambiguityResolutionResults.getResultingCalls()));
|
||||
Collection<DeclarationDescriptor> descriptors = Sets.newHashSet();
|
||||
for (ResolvedCall<? extends FunctionDescriptor> call : ambiguityResolutionResults.getResultingCalls()) {
|
||||
descriptors.add(call.getResultingDescriptor());
|
||||
for (ResolvedCall<?> resolvedCall : ambiguityResolutionResults.getResultingCalls()) {
|
||||
descriptors.add(resolvedCall.getResultingDescriptor());
|
||||
}
|
||||
dataFlowInfo = facade.getTypeInfo(right, context.replaceDataFlowInfo(dataFlowInfo)).getDataFlowInfo();
|
||||
context.trace.record(AMBIGUOUS_REFERENCE_TARGET, operationSign, descriptors);
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.CliLightClassGenerationSupport;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
@@ -71,17 +70,16 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
|
||||
}
|
||||
}
|
||||
|
||||
ImmutableMap<JetElement,ResolvedCall<? extends CallableDescriptor>> resolvedCallsEntries =
|
||||
bindingContext.getSliceContents(BindingContext.RESOLVED_CALL);
|
||||
for (Map.Entry<JetElement, ResolvedCall<? extends CallableDescriptor>> entry : resolvedCallsEntries.entrySet()) {
|
||||
ImmutableMap<JetElement, ResolvedCall<?>> resolvedCallsEntries = bindingContext.getSliceContents(BindingContext.RESOLVED_CALL);
|
||||
for (Map.Entry<JetElement, ResolvedCall<?>> entry : resolvedCallsEntries.entrySet()) {
|
||||
JetElement element = entry.getKey();
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = entry.getValue();
|
||||
ResolvedCall<?> resolvedCall = entry.getValue();
|
||||
|
||||
DiagnosticUtils.LineAndColumn lineAndColumn =
|
||||
DiagnosticUtils.getLineAndColumnInPsiFile(element.getContainingFile(), element.getTextRange());
|
||||
|
||||
assertTrue("Resolved call for '" + element.getText() + "'" + lineAndColumn + " in not completed",
|
||||
((ResolvedCallWithTrace<? extends CallableDescriptor>)resolvedCall).isCompleted());
|
||||
((ResolvedCallWithTrace<?>) resolvedCall).isCompleted());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,12 @@
|
||||
|
||||
package org.jetbrains.jet.resolve.calls
|
||||
|
||||
import com.google.common.collect.ImmutableMap
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import org.jetbrains.jet.ConfigurationKind
|
||||
import org.jetbrains.jet.JetLiteFixture
|
||||
import org.jetbrains.jet.JetTestUtils
|
||||
import org.jetbrains.jet.analyzer.AnalyzeExhaust
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils
|
||||
import org.jetbrains.jet.lang.psi.JetElement
|
||||
import org.jetbrains.jet.lang.psi.JetFile
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.jet.lang.resolve.calls.tasks.ExplicitReceiverKind
|
||||
@@ -54,14 +48,14 @@ public abstract class AbstractResolvedCallsTest() : JetLiteFixture() {
|
||||
}
|
||||
val explicitReceiverKind = directives.getExplicitReceiverKind()
|
||||
|
||||
fun analyzeFileAndGetResolvedCallEntries(): Map<JetElement, ResolvedCall<out CallableDescriptor?>> {
|
||||
fun analyzeFileAndGetResolvedCallEntries(): Map<JetElement, ResolvedCall<*>> {
|
||||
val psiFile = JetTestUtils.loadJetFile(getProject(), file)
|
||||
val analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, Collections.emptyList())
|
||||
val bindingContext = analyzeExhaust!!.getBindingContext()
|
||||
val bindingContext = analyzeExhaust.getBindingContext()
|
||||
return bindingContext.getSliceContents(BindingContext.RESOLVED_CALL)
|
||||
}
|
||||
|
||||
fun checkResolvedCall(resolvedCall: ResolvedCall<out CallableDescriptor?>, element: JetElement) {
|
||||
fun checkResolvedCall(resolvedCall: ResolvedCall<*>, element: JetElement) {
|
||||
val lineAndColumn = DiagnosticUtils.getLineAndColumnInPsiFile(element.getContainingFile(), element.getTextRange())
|
||||
|
||||
val (actualThisObject, actualReceiverArgument, actualExplicitReceiverKind) = with(resolvedCall) {
|
||||
|
||||
@@ -19,7 +19,10 @@ package org.jetbrains.jet.plugin.highlighter;
|
||||
import com.intellij.lang.annotation.AnnotationHolder;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
@@ -64,8 +67,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
|
||||
public void visitCallExpression(@NotNull JetCallExpression expression) {
|
||||
JetExpression callee = expression.getCalleeExpression();
|
||||
if (callee instanceof JetReferenceExpression) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
bindingContext.get(BindingContext.RESOLVED_CALL, (JetReferenceExpression) callee);
|
||||
ResolvedCall<?> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, (JetReferenceExpression) callee);
|
||||
if (resolvedCall != null) {
|
||||
DeclarationDescriptor calleeDescriptor = resolvedCall.getResultingDescriptor();
|
||||
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
|
||||
@@ -61,12 +61,12 @@ public class IdeRenderers {
|
||||
}
|
||||
|
||||
public static final Renderer<Collection<? extends ResolvedCall<?>>> HTML_AMBIGUOUS_CALLS =
|
||||
new Renderer<Collection<? extends ResolvedCall<? extends CallableDescriptor>>>() {
|
||||
new Renderer<Collection<? extends ResolvedCall<?>>>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String render(@NotNull Collection<? extends ResolvedCall<? extends CallableDescriptor>> calls) {
|
||||
public String render(@NotNull Collection<? extends ResolvedCall<?>> calls) {
|
||||
StringBuilder stringBuilder = new StringBuilder("");
|
||||
for (ResolvedCall<? extends CallableDescriptor> call : calls) {
|
||||
for (ResolvedCall<?> call : calls) {
|
||||
stringBuilder.append("<li>");
|
||||
stringBuilder.append(DescriptorRenderer.HTML.render(call.getResultingDescriptor()));
|
||||
stringBuilder.append("</li>");
|
||||
@@ -84,11 +84,9 @@ public class IdeRenderers {
|
||||
};
|
||||
|
||||
public static final Renderer<Collection<? extends ResolvedCall<?>>> HTML_NONE_APPLICABLE_CALLS =
|
||||
new Renderer<Collection<? extends ResolvedCall<? extends CallableDescriptor>>>() {
|
||||
new Renderer<Collection<? extends ResolvedCall<?>>>() {
|
||||
@Nullable
|
||||
private ValueParameterDescriptor findParameterByArgumentExpression(
|
||||
ResolvedCall<? extends CallableDescriptor> call,
|
||||
JetValueArgument argument) {
|
||||
private ValueParameterDescriptor findParameterByArgumentExpression(ResolvedCall<?> call, JetValueArgument argument) {
|
||||
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> entry : call.getValueArguments().entrySet()) {
|
||||
for (ValueArgument va : entry.getValue().getArguments()) {
|
||||
if (va == argument) {
|
||||
@@ -99,7 +97,7 @@ public class IdeRenderers {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Set<ValueParameterDescriptor> getParametersToHighlight(ResolvedCall<? extends CallableDescriptor> call) {
|
||||
private Set<ValueParameterDescriptor> getParametersToHighlight(ResolvedCall<?> call) {
|
||||
Set<ValueParameterDescriptor> parameters = new HashSet<ValueParameterDescriptor>();
|
||||
if (call instanceof ResolvedCallImpl) {
|
||||
Iterable<Diagnostic> diagnostics = ((ResolvedCallImpl)call).getTrace().getBindingContext().getDiagnostics();
|
||||
@@ -126,9 +124,9 @@ public class IdeRenderers {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String render(@NotNull Collection<? extends ResolvedCall<? extends CallableDescriptor>> calls) {
|
||||
public String render(@NotNull Collection<? extends ResolvedCall<?>> calls) {
|
||||
StringBuilder stringBuilder = new StringBuilder("");
|
||||
for (ResolvedCall<? extends CallableDescriptor> call : calls) {
|
||||
for (ResolvedCall<?> call : calls) {
|
||||
stringBuilder.append("<li>");
|
||||
CallableDescriptor funDescriptor = call.getResultingDescriptor();
|
||||
Set<ValueParameterDescriptor> parametersToHighlight = getParametersToHighlight(call);
|
||||
|
||||
@@ -55,7 +55,6 @@ import org.jetbrains.jet.util.slicedmap.ReadOnlySlice;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
|
||||
@@ -200,14 +199,13 @@ public class ResolveToolWindow extends JPanel implements Disposable {
|
||||
private static String renderDebugInfo(
|
||||
PsiElement currentElement,
|
||||
@Nullable ResolutionDebugInfo.Data debugInfo,
|
||||
@Nullable ResolvedCall<? extends CallableDescriptor> call
|
||||
@Nullable ResolvedCall<?> call
|
||||
) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
if (debugInfo != null) {
|
||||
List<? extends ResolutionTask<? extends CallableDescriptor, ?>> resolutionTasks = debugInfo.get(TASKS);
|
||||
for (ResolutionTask<? extends CallableDescriptor, ?> resolutionTask : resolutionTasks) {
|
||||
for (ResolvedCallWithTrace<? extends CallableDescriptor> resolvedCall : resolutionTask.getResolvedCalls()) {
|
||||
for (ResolutionTask<?, ?> resolutionTask : debugInfo.get(TASKS)) {
|
||||
for (ResolvedCallWithTrace<?> resolvedCall : resolutionTask.getResolvedCalls()) {
|
||||
renderResolutionLogForCall(debugInfo, resolvedCall, result);
|
||||
}
|
||||
}
|
||||
@@ -225,11 +223,7 @@ public class ResolveToolWindow extends JPanel implements Disposable {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static void renderResolutionLogForCall(
|
||||
Data debugInfo,
|
||||
ResolvedCallWithTrace<? extends CallableDescriptor> resolvedCall,
|
||||
StringBuilder result
|
||||
) {
|
||||
private static void renderResolutionLogForCall(Data debugInfo, ResolvedCallWithTrace<?> resolvedCall, StringBuilder result) {
|
||||
result.append("Trying to call ").append(resolvedCall.getCandidateDescriptor()).append("\n");
|
||||
StringBuilder errors = debugInfo.getByKey(ERRORS, resolvedCall);
|
||||
if (errors != null) {
|
||||
@@ -265,7 +259,7 @@ public class ResolveToolWindow extends JPanel implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private static String renderCall(StringBuilder builder, ResolvedCall<? extends CallableDescriptor> resolvedCall) {
|
||||
private static String renderCall(StringBuilder builder, ResolvedCall<?> resolvedCall) {
|
||||
CallableDescriptor resultingDescriptor = resolvedCall.getResultingDescriptor();
|
||||
ReceiverValue receiverArgument = resolvedCall.getReceiverArgument();
|
||||
ReceiverValue thisObject = resolvedCall.getThisObject();
|
||||
|
||||
@@ -67,7 +67,7 @@ public class AddNameToArgumentFix extends JetIntentionAction<JetValueArgument> {
|
||||
if (!(callee instanceof JetReferenceExpression)) return Collections.emptyList();
|
||||
|
||||
BindingContext context = AnalyzerFacadeWithCache.analyzeFileWithCache((JetFile) argument.getContainingFile()).getBindingContext();
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = context.get(BindingContext.RESOLVED_CALL, (JetReferenceExpression) callee);
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, (JetReferenceExpression) callee);
|
||||
if (resolvedCall == null) return Collections.emptyList();
|
||||
|
||||
CallableDescriptor callableDescriptor = resolvedCall.getResultingDescriptor();
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.jet.plugin.quickfix;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -27,7 +26,6 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
@@ -187,8 +185,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
|
||||
JetBinaryExpression expression = QuickFixUtil.getParentElementOfType(diagnostic, JetBinaryExpression.class);
|
||||
assert expression != null : "COMPARE_TO_TYPE_MISMATCH reported on element that is not within any expression";
|
||||
BindingContext context = AnalyzerFacadeWithCache.analyzeFileWithCache((JetFile) expression.getContainingFile()).getBindingContext();
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = context.get(BindingContext.RESOLVED_CALL,
|
||||
expression.getOperationReference());
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
|
||||
if (resolvedCall == null) return null;
|
||||
PsiElement compareTo = BindingContextUtils.descriptorToDeclaration(context, resolvedCall.getCandidateDescriptor());
|
||||
if (!(compareTo instanceof JetFunction)) return null;
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticWithParameters2;
|
||||
import org.jetbrains.jet.lang.diagnostics.Errors;
|
||||
@@ -72,7 +71,7 @@ public class QuickFixFactoryForTypeMismatchError implements JetIntentionActionsF
|
||||
|
||||
// Fixing overloaded operators:
|
||||
if (expression instanceof JetOperationExpression) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
ResolvedCall<?> resolvedCall =
|
||||
context.get(BindingContext.RESOLVED_CALL, ((JetOperationExpression) expression).getOperationReference());
|
||||
if (resolvedCall != null) {
|
||||
PsiElement declaration = BindingContextUtils.descriptorToDeclaration(context, resolvedCall.getResultingDescriptor());
|
||||
@@ -84,7 +83,7 @@ public class QuickFixFactoryForTypeMismatchError implements JetIntentionActionsF
|
||||
if (expression.getParent() instanceof JetBinaryExpression) {
|
||||
JetBinaryExpression parentBinary = (JetBinaryExpression) expression.getParent();
|
||||
if (parentBinary.getRight() == expression) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = context.get(BindingContext.RESOLVED_CALL, parentBinary.getOperationReference());
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, parentBinary.getOperationReference());
|
||||
if (resolvedCall != null) {
|
||||
PsiElement declaration = BindingContextUtils.descriptorToDeclaration(context, resolvedCall.getResultingDescriptor());
|
||||
if (declaration instanceof JetFunction) {
|
||||
@@ -97,7 +96,7 @@ public class QuickFixFactoryForTypeMismatchError implements JetIntentionActionsF
|
||||
|
||||
// Change function return type when TYPE_MISMATCH is reported on call expression:
|
||||
if (expression instanceof JetCallExpression) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
ResolvedCall<?> resolvedCall =
|
||||
context.get(BindingContext.RESOLVED_CALL, ((JetCallExpression) expression).getCalleeExpression());
|
||||
if (resolvedCall != null) {
|
||||
PsiElement declaration = BindingContextUtils.descriptorToDeclaration(context, resolvedCall.getResultingDescriptor());
|
||||
|
||||
@@ -99,7 +99,7 @@ public class QuickFixUtil {
|
||||
@Nullable
|
||||
public static JetParameterList getParameterListOfCallee(@NotNull JetCallExpression callExpression) {
|
||||
BindingContext context = AnalyzerFacadeWithCache.analyzeFileWithCache((JetFile) callExpression.getContainingFile()).getBindingContext();
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = context.get(BindingContext.RESOLVED_CALL, callExpression.getCalleeExpression());
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, callExpression.getCalleeExpression());
|
||||
if (resolvedCall == null) return null;
|
||||
PsiElement declaration = BindingContextUtils.descriptorToDeclaration(context, resolvedCall.getCandidateDescriptor());
|
||||
if (declaration instanceof JetFunction) {
|
||||
|
||||
@@ -45,12 +45,11 @@ import com.intellij.refactoring.util.RefactoringMessageDialog;
|
||||
import com.intellij.util.Function;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticFactory;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticFactory;
|
||||
import org.jetbrains.jet.lang.diagnostics.Errors;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
@@ -344,7 +343,7 @@ public class KotlinInlineValHandler extends InlineActionHandler {
|
||||
|
||||
JetExpression callee = callExpression.getCalleeExpression();
|
||||
BindingContext context = AnalyzerFacadeWithCache.getContextForElement(initializer);
|
||||
ResolvedCall<? extends CallableDescriptor> call = context.get(BindingContext.RESOLVED_CALL, callee);
|
||||
ResolvedCall<?> call = context.get(BindingContext.RESOLVED_CALL, callee);
|
||||
if (call == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.MultiRangeReference;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
@@ -49,7 +48,7 @@ class JetInvokeFunctionReference extends JetSimpleReference<JetCallExpression> i
|
||||
@Override
|
||||
@NotNull
|
||||
protected Collection<DeclarationDescriptor> getTargetDescriptors(@NotNull BindingContext context) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = context.get(RESOLVED_CALL, getExpression().getCalleeExpression());
|
||||
ResolvedCall<?> resolvedCall = context.get(RESOLVED_CALL, getExpression().getCalleeExpression());
|
||||
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
return Collections.<DeclarationDescriptor>singleton(((VariableAsFunctionResolvedCall) resolvedCall).getCandidateDescriptor());
|
||||
}
|
||||
|
||||
+1
-2
@@ -20,7 +20,6 @@ import com.google.dart.compiler.backend.js.ast.*;
|
||||
import com.intellij.util.SmartList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
@@ -125,7 +124,7 @@ public final class ClassInitializerTranslator extends AbstractTranslator {
|
||||
|
||||
@NotNull
|
||||
private List<JsExpression> translateArguments(@NotNull JetDelegatorToSuperCall superCall) {
|
||||
ResolvedCall<? extends CallableDescriptor> call = context().bindingContext().get(BindingContext.RESOLVED_CALL, superCall.getCalleeExpression());
|
||||
ResolvedCall<?> call = context().bindingContext().get(BindingContext.RESOLVED_CALL, superCall.getCalleeExpression());
|
||||
assert call != null : "ResolvedCall for superCall must be not null";
|
||||
return CallArgumentTranslator.translate(call, null, context()).getTranslateArguments();
|
||||
}
|
||||
|
||||
@@ -137,17 +137,15 @@ public final class BindingUtils {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ResolvedCall<?> getResolvedCall(@NotNull BindingContext context,
|
||||
@NotNull JetExpression expression) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = context.get(BindingContext.RESOLVED_CALL, expression);
|
||||
public static ResolvedCall<?> getResolvedCall(@NotNull BindingContext context, @NotNull JetExpression expression) {
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, expression);
|
||||
assert resolvedCall != null : message(expression, expression.getText() + " must resolve to a call");
|
||||
return resolvedCall;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ResolvedCall<?> getResolvedCallForProperty(@NotNull BindingContext context,
|
||||
@NotNull JetExpression expression) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = context.get(BindingContext.RESOLVED_CALL, expression);
|
||||
public static ResolvedCall<?> getResolvedCallForProperty(@NotNull BindingContext context, @NotNull JetExpression expression) {
|
||||
ResolvedCall<?> resolvedCall = context.get(BindingContext.RESOLVED_CALL, expression);
|
||||
assert resolvedCall != null : message(expression, expression.getText() + " must resolve to a call");
|
||||
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
return ((VariableAsFunctionResolvedCall) resolvedCall).getVariableCall();
|
||||
|
||||
Reference in New Issue
Block a user