debug names for temporary traces added
This commit is contained in:
@@ -203,7 +203,7 @@ public final class PsiCodegenPredictor {
|
||||
) {
|
||||
final Ref<DeclarationDescriptor> resultingDescriptor = Ref.create();
|
||||
|
||||
DelegatingBindingTrace trace = new DelegatingBindingTrace(context) {
|
||||
DelegatingBindingTrace trace = new DelegatingBindingTrace(context, "trace in PsiCodegenPredictor") {
|
||||
@Override
|
||||
public <K, V> void record(WritableSlice<K, V> slice, K key, V value) {
|
||||
super.record(slice, key, value);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class GenerationState {
|
||||
this.files = files;
|
||||
this.classBuilderMode = builderFactory.getClassBuilderMode();
|
||||
|
||||
bindingTrace = new DelegatingBindingTrace(exhaust.getBindingContext());
|
||||
bindingTrace = new DelegatingBindingTrace(exhaust.getBindingContext(), "trace in GenerationState");
|
||||
bindingContext = bindingTrace.getBindingContext();
|
||||
|
||||
this.typeMapper = new JetTypeMapper(bindingTrace, builtinToJavaTypesMapping == BuiltinToJavaTypesMapping.ENABLED, classBuilderMode);
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticHolder;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
|
||||
@@ -72,4 +73,14 @@ public class AnalyzingUtils {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static String formDebugNameForBindingTrace(@NotNull String debugName, @Nullable Object resolutionSubjectForMessage) {
|
||||
if (resolutionSubjectForMessage instanceof PsiElement) {
|
||||
resolutionSubjectForMessage = ((PsiElement) resolutionSubjectForMessage).getText();
|
||||
}
|
||||
if (resolutionSubjectForMessage != null) {
|
||||
return debugName + " '" + resolutionSubjectForMessage + "'";
|
||||
}
|
||||
return debugName;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -16,17 +16,19 @@
|
||||
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author svtk
|
||||
*/
|
||||
public class ChainedTemporaryBindingTrace extends TemporaryBindingTrace {
|
||||
|
||||
public static ChainedTemporaryBindingTrace create(TemporaryBindingTrace trace) {
|
||||
return new ChainedTemporaryBindingTrace(trace);
|
||||
public static ChainedTemporaryBindingTrace create(TemporaryBindingTrace trace, String debugName, @Nullable Object resolutionSubjectForMessage) {
|
||||
return new ChainedTemporaryBindingTrace(trace, AnalyzingUtils.formDebugNameForBindingTrace(debugName, resolutionSubjectForMessage));
|
||||
}
|
||||
|
||||
private ChainedTemporaryBindingTrace(TemporaryBindingTrace trace) {
|
||||
super(trace);
|
||||
private ChainedTemporaryBindingTrace(TemporaryBindingTrace trace, String debugName) {
|
||||
super(trace, debugName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,6 +36,7 @@ public class DelegatingBindingTrace implements BindingTrace {
|
||||
private final BindingContext parentContext;
|
||||
private final MutableSlicedMap map = SlicedMapImpl.create();
|
||||
private final List<Diagnostic> diagnostics = Lists.newArrayList();
|
||||
private final String name;
|
||||
|
||||
private final BindingContext bindingContext = new BindingContext() {
|
||||
@Override
|
||||
@@ -67,8 +68,13 @@ public class DelegatingBindingTrace implements BindingTrace {
|
||||
}
|
||||
};
|
||||
|
||||
public DelegatingBindingTrace(BindingContext parentContext) {
|
||||
public DelegatingBindingTrace(BindingContext parentContext, String debugName) {
|
||||
this.parentContext = parentContext;
|
||||
this.name = debugName;
|
||||
}
|
||||
|
||||
public DelegatingBindingTrace(BindingContext parentContext, String debugName, @Nullable Object resolutionSubjectForMessage) {
|
||||
this(parentContext, AnalyzingUtils.formDebugNameForBindingTrace(debugName, resolutionSubjectForMessage));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,4 +154,9 @@ public class DelegatingBindingTrace implements BindingTrace {
|
||||
public void report(@NotNull Diagnostic diagnostic) {
|
||||
diagnostics.add(diagnostic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,8 @@ public class ImportsResolver {
|
||||
Collection<JetImportDirective> defaultImportDirectives = Lists.newArrayList();
|
||||
configuration.addDefaultImports(defaultImportDirectives);
|
||||
for (JetImportDirective defaultImportDirective : defaultImportDirectives) {
|
||||
TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(trace); //not to trace errors of default imports
|
||||
TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(
|
||||
trace, "transient trace to resolve default imports"); //not to trace errors of default imports
|
||||
qualifiedExpressionResolver.processImportReference(defaultImportDirective, rootScope, namespaceScope, delayedImporter,
|
||||
temporaryTrace, configuration, onlyClasses);
|
||||
}
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ public class QualifiedExpressionResolver {
|
||||
if (descriptors.size() == 1) {
|
||||
return canImportMembersFrom(descriptors.iterator().next(), reference, trace, onlyClasses);
|
||||
}
|
||||
TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(trace);
|
||||
TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(trace, "trace to find out if members can be imported from", reference);
|
||||
boolean canImport = false;
|
||||
for (DeclarationDescriptor descriptor : descriptors) {
|
||||
canImport |= canImportMembersFrom(descriptor, reference, temporaryTrace, onlyClasses);
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.util.slicedmap.WritableSlice;
|
||||
|
||||
/**
|
||||
@@ -25,14 +27,18 @@ import org.jetbrains.jet.util.slicedmap.WritableSlice;
|
||||
*/
|
||||
public class TemporaryBindingTrace extends DelegatingBindingTrace {
|
||||
|
||||
public static TemporaryBindingTrace create(@NotNull BindingTrace trace) {
|
||||
return new TemporaryBindingTrace(trace);
|
||||
public static TemporaryBindingTrace create(@NotNull BindingTrace trace, String debugName) {
|
||||
return new TemporaryBindingTrace(trace, debugName);
|
||||
}
|
||||
|
||||
public static TemporaryBindingTrace create(@NotNull BindingTrace trace, String debugName, @Nullable Object resolutionSubjectForMessage) {
|
||||
return create(trace, AnalyzingUtils.formDebugNameForBindingTrace(debugName, resolutionSubjectForMessage));
|
||||
}
|
||||
|
||||
protected final BindingTrace trace;
|
||||
|
||||
protected TemporaryBindingTrace(@NotNull BindingTrace trace) {
|
||||
super(trace.getBindingContext());
|
||||
protected TemporaryBindingTrace(@NotNull BindingTrace trace, String debugName) {
|
||||
super(trace.getBindingContext(), debugName);
|
||||
this.trace = trace;
|
||||
}
|
||||
|
||||
|
||||
@@ -283,12 +283,13 @@ public class CallResolver {
|
||||
return cachedResults;
|
||||
}
|
||||
}
|
||||
TemporaryBindingTrace delegatingBindingTrace = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace delegatingBindingTrace = TemporaryBindingTrace.create(context.trace, "trace to resolve call", context.call);
|
||||
BasicResolutionContext newContext = context.replaceTrace(delegatingBindingTrace);
|
||||
OverloadResolutionResults<F> results = doResolveCall(newContext,
|
||||
prioritizedTasks,
|
||||
callTransformer, reference);
|
||||
DelegatingBindingTrace cloneDelta = new DelegatingBindingTrace(new BindingTraceContext().getBindingContext());
|
||||
DelegatingBindingTrace cloneDelta = new DelegatingBindingTrace(
|
||||
new BindingTraceContext().getBindingContext(), "delta trace for caching resolve of", context.call);
|
||||
delegatingBindingTrace.addAllMyDataTo(cloneDelta);
|
||||
cacheResults(resolutionResultsSlice, context, results, cloneDelta);
|
||||
|
||||
@@ -465,7 +466,7 @@ public class CallResolver {
|
||||
TemporaryBindingTrace traceForFirstNonemptyCandidateSet = null;
|
||||
OverloadResolutionResultsImpl<F> resultsForFirstNonemptyCandidateSet = null;
|
||||
for (ResolutionTask<D, F> task : prioritizedTasks) {
|
||||
TemporaryBindingTrace taskTrace = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace taskTrace = TemporaryBindingTrace.create(context.trace, "trace to resolve a task for", task.reference);
|
||||
OverloadResolutionResultsImpl<F> results = performResolutionGuardedForExtraFunctionLiteralArguments(task.withTrace(taskTrace),
|
||||
callTransformer, context.trace);
|
||||
if (results.isSuccess() || results.isAmbiguity()) {
|
||||
@@ -530,8 +531,9 @@ public class CallResolver {
|
||||
// We have some candidates that failed for some reason
|
||||
// And we have a suspect: the function literal argument
|
||||
// Now, we try to remove this argument and see if it helps
|
||||
ResolutionTask<D, F> newTask = new ResolutionTask<D, F>(task.getCandidates(), task.reference, TemporaryBindingTrace.create(task.trace), task.scope,
|
||||
new DelegatingCall(task.call) {
|
||||
ResolutionTask<D, F> newTask = new ResolutionTask<D, F>(task.getCandidates(), task.reference,
|
||||
TemporaryBindingTrace.create(task.trace, "trace for resolution guarded for extra function literal arguments"),
|
||||
task.scope, new DelegatingCall(task.call) {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<JetExpression> getFunctionLiteralArguments() {
|
||||
@@ -554,7 +556,8 @@ public class CallResolver {
|
||||
@NotNull BindingTrace traceForResolutionCache) {
|
||||
|
||||
for (ResolutionCandidate<D> resolutionCandidate : task.getCandidates()) {
|
||||
TemporaryBindingTrace candidateTrace = TemporaryBindingTrace.create(task.trace);
|
||||
TemporaryBindingTrace candidateTrace = TemporaryBindingTrace.create(
|
||||
task.trace, "trace to resolve candidate", resolutionCandidate);
|
||||
Collection<CallResolutionContext<D, F>> contexts = callTransformer.createCallContexts(resolutionCandidate, task, candidateTrace);
|
||||
for (CallResolutionContext<D, F> context : contexts) {
|
||||
|
||||
@@ -799,14 +802,17 @@ public class CallResolver {
|
||||
@NotNull ResolutionContext context) {
|
||||
|
||||
JetType effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument);
|
||||
TemporaryBindingTrace traceForUnknown = TemporaryBindingTrace.create(context.trace);
|
||||
JetExpression argumentExpression = valueArgument.getArgumentExpression();
|
||||
JetType type = argumentExpression != null
|
||||
? expressionTypingServices.getType(
|
||||
context.scope, argumentExpression,
|
||||
substitutor.substitute(effectiveExpectedType, Variance.INVARIANT),
|
||||
context.dataFlowInfo, traceForUnknown)
|
||||
: null;
|
||||
JetType type;
|
||||
if (argumentExpression != null) {
|
||||
TemporaryBindingTrace traceForUnknown = TemporaryBindingTrace.create(
|
||||
context.trace, "transient trace to resolve argument", argumentExpression);
|
||||
type = expressionTypingServices.getType(context.scope, argumentExpression,
|
||||
substitutor.substitute(effectiveExpectedType, Variance.INVARIANT), context.dataFlowInfo, traceForUnknown);
|
||||
}
|
||||
else {
|
||||
type = null;
|
||||
}
|
||||
constraintSystem.addSupertypeConstraint(effectiveExpectedType, type, ConstraintPosition.getValueParameterPosition(
|
||||
valueParameterDescriptor.getIndex()));
|
||||
//todo no return
|
||||
@@ -1149,7 +1155,7 @@ public class CallResolver {
|
||||
List<ResolutionCandidate<FunctionDescriptor>> candidates = findCandidatesByExactSignature(scope, receiver, name, parameterTypes);
|
||||
|
||||
BindingTraceContext trace = new BindingTraceContext();
|
||||
TemporaryBindingTrace temporaryBindingTrace = TemporaryBindingTrace.create(trace);
|
||||
TemporaryBindingTrace temporaryBindingTrace = TemporaryBindingTrace.create(trace, "trace for resolve exact signature call", name);
|
||||
Set<ResolvedCallWithTrace<FunctionDescriptor>> calls = Sets.newLinkedHashSet();
|
||||
for (ResolutionCandidate<FunctionDescriptor> candidate : candidates) {
|
||||
ResolvedCallImpl<FunctionDescriptor> call = ResolvedCallImpl.create(candidate, temporaryBindingTrace);
|
||||
|
||||
@@ -115,7 +115,7 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
|
||||
private CallResolutionContext<CallableDescriptor, FunctionDescriptor> createContextWithChainedTrace(ResolutionCandidate<CallableDescriptor> candidate,
|
||||
Call call, TemporaryBindingTrace temporaryTrace, ResolutionTask<CallableDescriptor, FunctionDescriptor> task) {
|
||||
|
||||
ChainedTemporaryBindingTrace chainedTrace = ChainedTemporaryBindingTrace.create(temporaryTrace);
|
||||
ChainedTemporaryBindingTrace chainedTrace = ChainedTemporaryBindingTrace.create(temporaryTrace, "chained trace to resolve candidate", candidate);
|
||||
ResolvedCallImpl<CallableDescriptor> resolvedCall = ResolvedCallImpl.create(candidate, chainedTrace);
|
||||
return CallResolutionContext.create(resolvedCall, task, chainedTrace, task.tracing, call);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,8 @@ public class ResolveSessionUtils {
|
||||
@NotNull final ResolveSession resolveSession,
|
||||
@NotNull JetExpression expression
|
||||
) {
|
||||
final DelegatingBindingTrace trace = new DelegatingBindingTrace(resolveSession.getBindingContext());
|
||||
final DelegatingBindingTrace trace = new DelegatingBindingTrace(
|
||||
resolveSession.getBindingContext(), "trace to resolve expression", expression);
|
||||
JetFile file = (JetFile) expression.getContainingFile();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -225,7 +226,8 @@ public class ResolveSessionUtils {
|
||||
}
|
||||
|
||||
public static JetScope getExpressionMemberScope(@NotNull ResolveSession resolveSession, @NotNull JetExpression expression) {
|
||||
DelegatingBindingTrace trace = new DelegatingBindingTrace(resolveSession.getBindingContext());
|
||||
DelegatingBindingTrace trace = new DelegatingBindingTrace(
|
||||
resolveSession.getBindingContext(), "trace to resolve a member scope of expression", expression);
|
||||
|
||||
if (expression instanceof JetReferenceExpression) {
|
||||
QualifiedExpressionResolver qualifiedExpressionResolver = resolveSession.getInjector().getQualifiedExpressionResolver();
|
||||
|
||||
+15
-9
@@ -99,7 +99,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
}
|
||||
}
|
||||
JetType[] result = new JetType[1];
|
||||
TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(
|
||||
context.trace, "trace for namespace/class object lookup of name", referencedName);
|
||||
if (furtherNameLookup(expression, referencedName, result, context.replaceBindingTrace(temporaryTrace))) {
|
||||
temporaryTrace.commit();
|
||||
return DataFlowUtils.checkType(result[0], expression, context);
|
||||
@@ -201,7 +202,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
|
||||
boolean tryWithNoExpectedType = true;
|
||||
if (isTypeFlexible(left) || operationType == JetTokens.COLON) {
|
||||
TemporaryBindingTrace temporaryTraceWithExpectedType = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace temporaryTraceWithExpectedType = TemporaryBindingTrace.create(
|
||||
context.trace, "trace for resolve RHSExpression", expression);
|
||||
ExpressionTypingContext contextWithTemporaryTrace = context.replaceBindingTrace(temporaryTraceWithExpectedType).replaceExpectedType(targetType);
|
||||
JetTypeInfo typeInfo = facade.getTypeInfo(left, contextWithTemporaryTrace);
|
||||
if (typeInfo.getType() != null && checkBinaryWithTypeRHS(expression, contextWithTemporaryTrace, targetType, typeInfo.getType())) {
|
||||
@@ -633,7 +635,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
private JetType getVariableType(@NotNull JetSimpleNameExpression nameExpression, @NotNull ReceiverDescriptor receiver,
|
||||
@Nullable ASTNode callOperationNode, @NotNull ExpressionTypingContext context, @NotNull boolean[] result) {
|
||||
|
||||
TemporaryBindingTrace traceForVariable = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace traceForVariable = TemporaryBindingTrace.create(
|
||||
context.trace, "trace to resolve as local variable or property", nameExpression);
|
||||
OverloadResolutionResults<VariableDescriptor> resolutionResult = context.replaceBindingTrace(traceForVariable).resolveSimpleProperty(receiver, callOperationNode, nameExpression);
|
||||
if (!resolutionResult.isNothing()) {
|
||||
traceForVariable.commit();
|
||||
@@ -645,7 +648,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
ExpressionTypingContext newContext = receiver.exists()
|
||||
? context.replaceScope(receiver.getType().getMemberScope())
|
||||
: context;
|
||||
TemporaryBindingTrace traceForNamespaceOrClassObject = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace traceForNamespaceOrClassObject = TemporaryBindingTrace.create(
|
||||
context.trace, "trace to resolve as namespace or class object", nameExpression);
|
||||
JetType jetType = lookupNamespaceOrClassObject(nameExpression, nameExpression.getReferencedNameAsName(), newContext.replaceBindingTrace(traceForNamespaceOrClassObject));
|
||||
if (jetType != null) {
|
||||
traceForNamespaceOrClassObject.commit();
|
||||
@@ -693,7 +697,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
|
||||
boolean[] result = new boolean[1];
|
||||
|
||||
TemporaryBindingTrace traceForVariable = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace traceForVariable = TemporaryBindingTrace.create(context.trace, "trace to resolve as variable", nameExpression);
|
||||
JetType type = getVariableType(nameExpression, receiver, callOperationNode, context.replaceBindingTrace(traceForVariable), result);
|
||||
if (result[0]) {
|
||||
traceForVariable.commit();
|
||||
@@ -701,7 +705,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
}
|
||||
|
||||
Call call = CallMaker.makeCall(nameExpression, receiver, callOperationNode, nameExpression, Collections.<ValueArgument>emptyList());
|
||||
TemporaryBindingTrace traceForFunction = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace traceForFunction = TemporaryBindingTrace.create(context.trace, "trace to resolve as function", nameExpression);
|
||||
FunctionDescriptor functionDescriptor = getFunctionDescriptor(call, nameExpression, receiver, context, result);
|
||||
if (result[0]) {
|
||||
traceForFunction.commit();
|
||||
@@ -722,7 +726,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
boolean[] result = new boolean[1];
|
||||
Call call = CallMaker.makeCall(receiver, callOperationNode, callExpression);
|
||||
|
||||
TemporaryBindingTrace traceForFunction = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace traceForFunction = TemporaryBindingTrace.create(context.trace, "trace to resolve as function call", callExpression);
|
||||
FunctionDescriptor functionDescriptor = getFunctionDescriptor(call, callExpression, receiver,
|
||||
context.replaceBindingTrace(traceForFunction), result);
|
||||
if (result[0]) {
|
||||
@@ -753,7 +757,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
|
||||
JetExpression calleeExpression = callExpression.getCalleeExpression();
|
||||
if (calleeExpression instanceof JetSimpleNameExpression && callExpression.getTypeArgumentList() == null) {
|
||||
TemporaryBindingTrace traceForVariable = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace traceForVariable = TemporaryBindingTrace.create(
|
||||
context.trace, "trace to resolve as variable with 'invoke' call", callExpression);
|
||||
JetType type = getVariableType((JetSimpleNameExpression) calleeExpression, receiver, callOperationNode,
|
||||
context.replaceBindingTrace(traceForVariable), result);
|
||||
if (result[0]) {
|
||||
@@ -828,7 +833,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
JetExpression stubExpression = ExpressionTypingUtils.createStubExpressionOfNecessaryType(baseExpression.getProject(), type, context.trace);
|
||||
resolveArrayAccessSetMethod((JetArrayAccessExpression) baseExpression,
|
||||
stubExpression,
|
||||
context.replaceExpectedType(NO_EXPECTED_TYPE).replaceBindingTrace(TemporaryBindingTrace.create(context.trace)),
|
||||
context.replaceExpectedType(NO_EXPECTED_TYPE).replaceBindingTrace(
|
||||
TemporaryBindingTrace.create(context.trace, "trace to resolve array access set method for unary expression", expression)),
|
||||
context.trace);
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -58,7 +58,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
return DataFlowUtils.checkType(type, expression, context, context.dataFlowInfo);
|
||||
}
|
||||
final JetType[] result = new JetType[1];
|
||||
final TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(context.trace);
|
||||
final TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(context.trace, "trace to resolve object literal expression", expression);
|
||||
ObservableBindingTrace.RecordHandler<PsiElement, ClassDescriptor> handler = new ObservableBindingTrace.RecordHandler<PsiElement, ClassDescriptor>() {
|
||||
|
||||
@Override
|
||||
@@ -83,7 +83,8 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
TopDownAnalyzer.processClassOrObject(context.expressionTypingServices.getProject(), traceAdapter, context.scope,
|
||||
context.scope.getContainingDeclaration(), expression.getObjectDeclaration());
|
||||
|
||||
DelegatingBindingTrace cloneDelta = new DelegatingBindingTrace(new BindingTraceContext().getBindingContext());
|
||||
DelegatingBindingTrace cloneDelta = new DelegatingBindingTrace(
|
||||
new BindingTraceContext().getBindingContext(), "cached delta trace for object literal expression resolve", expression);
|
||||
temporaryTrace.addAllMyDataTo(cloneDelta);
|
||||
context.trace.record(TRACE_DELTAS_CACHE, expression.getObjectDeclaration(), cloneDelta);
|
||||
temporaryTrace.commit();
|
||||
@@ -112,7 +113,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
JetType returnType = TypeUtils.NO_EXPECTED_TYPE;
|
||||
JetScope functionInnerScope = FunctionDescriptorUtil.getFunctionInnerScope(context.scope, functionDescriptor, context.trace);
|
||||
JetTypeReference returnTypeRef = functionLiteral.getReturnTypeRef();
|
||||
TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace temporaryTrace = TemporaryBindingTrace.create(context.trace, "trace to resolve function literal expression", expression);
|
||||
if (returnTypeRef != null) {
|
||||
returnType = context.expressionTypingServices.getTypeResolver().resolveType(context.scope, returnTypeRef, context.trace, true);
|
||||
context.expressionTypingServices.checkFunctionReturnType(expression, context.replaceScope(functionInnerScope).
|
||||
|
||||
+2
-2
@@ -291,13 +291,13 @@ public class ExpressionTypingServices {
|
||||
if (context.expectedType != NO_EXPECTED_TYPE) {
|
||||
if (coercionStrategyForLastExpression == CoercionStrategy.COERCION_TO_UNIT && KotlinBuiltIns.getInstance().isUnit(context.expectedType)) {
|
||||
// This implements coercion to Unit
|
||||
TemporaryBindingTrace temporaryTraceExpectingUnit = TemporaryBindingTrace.create(trace);
|
||||
TemporaryBindingTrace temporaryTraceExpectingUnit = TemporaryBindingTrace.create(trace, "trace to resolve coercion to unit with expected type");
|
||||
final boolean[] mismatch = new boolean[1];
|
||||
ObservableBindingTrace errorInterceptingTrace = makeTraceInterceptingTypeMismatch(temporaryTraceExpectingUnit, statementExpression, mismatch);
|
||||
newContext = createContext(newContext, errorInterceptingTrace, scope, newContext.dataFlowInfo, context.expectedType);
|
||||
result = blockLevelVisitor.getTypeInfo(statementExpression, newContext, true);
|
||||
if (mismatch[0]) {
|
||||
TemporaryBindingTrace temporaryTraceNoExpectedType = TemporaryBindingTrace.create(trace);
|
||||
TemporaryBindingTrace temporaryTraceNoExpectedType = TemporaryBindingTrace.create(trace, "trace to resolve coercion to unit without expected type");
|
||||
mismatch[0] = false;
|
||||
ObservableBindingTrace interceptingTrace = makeTraceInterceptingTypeMismatch(temporaryTraceNoExpectedType, statementExpression, mismatch);
|
||||
newContext = createContext(newContext, interceptingTrace, scope, newContext.dataFlowInfo, NO_EXPECTED_TYPE);
|
||||
|
||||
+1
-1
@@ -287,7 +287,7 @@ public class ExpressionTypingUtils {
|
||||
@NotNull Name name
|
||||
) {
|
||||
final JetReferenceExpression fake = JetPsiFactory.createSimpleName(context.expressionTypingServices.getProject(), "fake");
|
||||
TemporaryBindingTrace fakeTrace = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace fakeTrace = TemporaryBindingTrace.create(context.trace, "trace for resolve fake call for", name);
|
||||
Call call = CallMaker.makeCall(fake, receiver, null, fake, Collections.<ValueArgument>emptyList());
|
||||
OverloadResolutionResults<FunctionDescriptor> results =
|
||||
context.replaceBindingTrace(fakeTrace).resolveCallWithGivenName(call, fake, name);
|
||||
|
||||
+6
-4
@@ -197,7 +197,8 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
if (right == null) return null;
|
||||
|
||||
//There is a temporary binding trace for an opportunity to resolve set method for array if needed (the initial trace should be used there)
|
||||
TemporaryBindingTrace temporaryBindingTrace = TemporaryBindingTrace.create(contextWithExpectedType.trace);
|
||||
TemporaryBindingTrace temporaryBindingTrace = TemporaryBindingTrace.create(
|
||||
contextWithExpectedType.trace, "trace to resolve array set method for binary expression", expression);
|
||||
ExpressionTypingContext context = contextWithExpectedType.replaceExpectedType(TypeUtils.NO_EXPECTED_TYPE).replaceBindingTrace(temporaryBindingTrace);
|
||||
|
||||
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
||||
@@ -217,13 +218,13 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
// We check that defined only one of '+=' and '+' operations, and call it (in the case '+' we then also assign)
|
||||
// Check for '+='
|
||||
Name name = OperatorConventions.ASSIGNMENT_OPERATIONS.get(operationType);
|
||||
TemporaryBindingTrace assignmentOperationTrace = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace assignmentOperationTrace = TemporaryBindingTrace.create(context.trace, "trace to check assignment operation like '+=' for", expression);
|
||||
OverloadResolutionResults<FunctionDescriptor> assignmentOperationDescriptors = basic.getResolutionResultsForBinaryCall(scope, name, context.replaceBindingTrace(assignmentOperationTrace), expression, receiver);
|
||||
JetType assignmentOperationType = OverloadResolutionResultsUtil.getResultType(assignmentOperationDescriptors);
|
||||
|
||||
// Check for '+'
|
||||
Name counterpartName = OperatorConventions.BINARY_OPERATION_NAMES.get(OperatorConventions.ASSIGNMENT_OPERATION_COUNTERPARTS.get(operationType));
|
||||
TemporaryBindingTrace binaryOperationTrace = TemporaryBindingTrace.create(context.trace);
|
||||
TemporaryBindingTrace binaryOperationTrace = TemporaryBindingTrace.create(context.trace, "trace to check binary operation like '+' for", expression);
|
||||
OverloadResolutionResults<FunctionDescriptor> binaryOperationDescriptors = basic.getResolutionResultsForBinaryCall(scope, counterpartName, context.replaceBindingTrace(binaryOperationTrace), expression, receiver);
|
||||
JetType binaryOperationType = OverloadResolutionResultsUtil.getResultType(binaryOperationDescriptors);
|
||||
|
||||
@@ -248,7 +249,8 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
binaryOperationTrace.commit();
|
||||
context.trace.record(VARIABLE_REASSIGNMENT, expression);
|
||||
if (left instanceof JetArrayAccessExpression) {
|
||||
ExpressionTypingContext contextForResolve = context.replaceScope(scope).replaceBindingTrace(TemporaryBindingTrace.create(contextWithExpectedType.trace));
|
||||
ExpressionTypingContext contextForResolve = context.replaceScope(scope).replaceBindingTrace(TemporaryBindingTrace.create(
|
||||
contextWithExpectedType.trace, "trace to resolve array set method for assignment", expression));
|
||||
basic.resolveArrayAccessSetMethod((JetArrayAccessExpression) left, right, contextForResolve, context.trace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class JetPositionManager implements PositionManager {
|
||||
|
||||
List<JetFile> namespaceFiles = JetFilesProvider.getInstance(file.getProject()).allNamespaceFiles().fun(file);
|
||||
|
||||
final DelegatingBindingTrace bindingTrace = new DelegatingBindingTrace(analyzeExhaust.getBindingContext());
|
||||
final DelegatingBindingTrace bindingTrace = new DelegatingBindingTrace(analyzeExhaust.getBindingContext(), "trace created in JetPositionManager");
|
||||
JetTypeMapper typeMapper = new JetTypeMapper(bindingTrace, true, ClassBuilderMode.FULL);
|
||||
//noinspection unchecked
|
||||
CodegenBinding.initTrace(bindingTrace, namespaceFiles);
|
||||
|
||||
@@ -106,7 +106,7 @@ public final class AnalyzerFacadeWithCache {
|
||||
file.getProject(),
|
||||
Collections.<AnalyzerScriptParameter>emptyList(),
|
||||
new JetFilesProvider.SameJetFilePredicate(file),
|
||||
new DelegatingBindingTrace(analyzeExhaustHeaders.getBindingContext()),
|
||||
new DelegatingBindingTrace(analyzeExhaustHeaders.getBindingContext(), "trace to resolve bodies in file", file.getName()),
|
||||
context,
|
||||
moduleConfiguration);
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class MigrateTuplesInProjectFix extends JetIntentionAction<PsiElement> {
|
||||
initialFile.getProject(),
|
||||
Collections.<AnalyzerScriptParameter>emptyList(),
|
||||
Predicates.<PsiFile>alwaysTrue(),
|
||||
new DelegatingBindingTrace(analyzeExhaustHeaders.getBindingContext()),
|
||||
new DelegatingBindingTrace(analyzeExhaustHeaders.getBindingContext(), "trace in migrate tuples fix"),
|
||||
context,
|
||||
moduleConfiguration);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class JetPositionManagerTest extends PositionManagerTestCase {
|
||||
JetPositionManager positionManager = (JetPositionManager) jetPositionManagerFactory.createPositionManager(process);
|
||||
assertNotNull(positionManager);
|
||||
|
||||
DelegatingBindingTrace bindingTrace = new DelegatingBindingTrace(state.getBindingContext());
|
||||
DelegatingBindingTrace bindingTrace = new DelegatingBindingTrace(state.getBindingContext(), "trace created in JetPositionManagerTest");
|
||||
JetTypeMapper typeMapper = new JetTypeMapper(bindingTrace, true, ClassBuilderMode.FULL);
|
||||
//noinspection unchecked
|
||||
CodegenBinding.initTrace(bindingTrace, files);
|
||||
|
||||
@@ -88,7 +88,7 @@ public final class AnalyzerFacadeForJS {
|
||||
BindingContext libraryBindingContext = config.getLibraryBindingContext();
|
||||
BindingTrace trace = libraryBindingContext == null ?
|
||||
new ObservableBindingTrace(new BindingTraceContext()) :
|
||||
new DelegatingBindingTrace(libraryBindingContext);
|
||||
new DelegatingBindingTrace(libraryBindingContext, "trace for analyzing library in js");
|
||||
InjectorForTopDownAnalyzerForJs injector = new InjectorForTopDownAnalyzerForJs(
|
||||
project, topDownAnalysisParameters, trace, owner,
|
||||
new JsConfiguration(project, libraryBindingContext));
|
||||
|
||||
@@ -110,7 +110,7 @@ public final class CallBuilder {
|
||||
resolvedCall = ResolvedCallImpl.create(ResolutionCandidate.create(descriptor, descriptor.getExpectedThisObject(),
|
||||
descriptor.getReceiverParameter(),
|
||||
ExplicitReceiverKind.THIS_OBJECT, false),
|
||||
TemporaryBindingTrace.create(new BindingTraceContext()));
|
||||
TemporaryBindingTrace.create(new BindingTraceContext(), "trace to resolve call (in js)"));
|
||||
}
|
||||
if (descriptor == null) {
|
||||
descriptor = resolvedCall.getCandidateDescriptor().getOriginal();
|
||||
|
||||
Reference in New Issue
Block a user