rename:
getAutoCastVariantsIncludingReceiver -> getAutoCastVariants getAutoCastVariants -> getAutoCastVariantsExcludingReceiver
This commit is contained in:
@@ -828,7 +828,7 @@ public class CandidateResolver {
|
|||||||
) {
|
) {
|
||||||
ExpressionReceiver receiverToCast = new ExpressionReceiver(JetPsiUtil.safeDeparenthesize(expression, false), actualType);
|
ExpressionReceiver receiverToCast = new ExpressionReceiver(JetPsiUtil.safeDeparenthesize(expression, false), actualType);
|
||||||
List<ReceiverValue> variants =
|
List<ReceiverValue> variants =
|
||||||
AutoCastUtils.getAutoCastVariants(context.trace.getBindingContext(), context.dataFlowInfo, receiverToCast);
|
AutoCastUtils.getAutoCastVariantsExcludingReceiver(context.trace.getBindingContext(), context.dataFlowInfo, receiverToCast);
|
||||||
for (ReceiverValue receiverValue : variants) {
|
for (ReceiverValue receiverValue : variants) {
|
||||||
JetType possibleType = receiverValue.getType();
|
JetType possibleType = receiverValue.getType();
|
||||||
if (JetTypeChecker.INSTANCE.isSubtypeOf(possibleType, expectedType)) {
|
if (JetTypeChecker.INSTANCE.isSubtypeOf(possibleType, expectedType)) {
|
||||||
|
|||||||
+6
-6
@@ -39,21 +39,21 @@ public class AutoCastUtils {
|
|||||||
|
|
||||||
private AutoCastUtils() {}
|
private AutoCastUtils() {}
|
||||||
|
|
||||||
public static List<ReceiverValue> getAutoCastVariantsIncludingReceiver(
|
public static List<ReceiverValue> getAutoCastVariants(
|
||||||
@NotNull ReceiverValue receiverToCast,
|
@NotNull ReceiverValue receiverToCast,
|
||||||
@NotNull ResolutionContext context
|
@NotNull ResolutionContext context
|
||||||
) {
|
) {
|
||||||
return getAutoCastVariantsIncludingReceiver(receiverToCast, context.trace.getBindingContext(), context.dataFlowInfo);
|
return getAutoCastVariants(receiverToCast, context.trace.getBindingContext(), context.dataFlowInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ReceiverValue> getAutoCastVariantsIncludingReceiver(
|
public static List<ReceiverValue> getAutoCastVariants(
|
||||||
@NotNull ReceiverValue receiverToCast,
|
@NotNull ReceiverValue receiverToCast,
|
||||||
@NotNull BindingContext bindingContext,
|
@NotNull BindingContext bindingContext,
|
||||||
@NotNull DataFlowInfo dataFlowInfo
|
@NotNull DataFlowInfo dataFlowInfo
|
||||||
) {
|
) {
|
||||||
List<ReceiverValue> variants = Lists.newArrayList();
|
List<ReceiverValue> variants = Lists.newArrayList();
|
||||||
variants.add(receiverToCast);
|
variants.add(receiverToCast);
|
||||||
variants.addAll(getAutoCastVariants(bindingContext, dataFlowInfo, receiverToCast));
|
variants.addAll(getAutoCastVariantsExcludingReceiver(bindingContext, dataFlowInfo, receiverToCast));
|
||||||
return variants;
|
return variants;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ public class AutoCastUtils {
|
|||||||
* @return variants @param receiverToCast may be cast to according to @param dataFlowInfo, @param receiverToCast itself is NOT included
|
* @return variants @param receiverToCast may be cast to according to @param dataFlowInfo, @param receiverToCast itself is NOT included
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static List<ReceiverValue> getAutoCastVariants(
|
public static List<ReceiverValue> getAutoCastVariantsExcludingReceiver(
|
||||||
@NotNull BindingContext bindingContext,
|
@NotNull BindingContext bindingContext,
|
||||||
@NotNull DataFlowInfo dataFlowInfo,
|
@NotNull DataFlowInfo dataFlowInfo,
|
||||||
@NotNull ReceiverValue receiverToCast
|
@NotNull ReceiverValue receiverToCast
|
||||||
@@ -79,7 +79,7 @@ public class AutoCastUtils {
|
|||||||
return collectAutoCastReceiverValues(dataFlowInfo, receiver, dataFlowValue);
|
return collectAutoCastReceiverValues(dataFlowInfo, receiver, dataFlowValue);
|
||||||
}
|
}
|
||||||
else if (receiverToCast instanceof AutoCastReceiver) {
|
else if (receiverToCast instanceof AutoCastReceiver) {
|
||||||
return getAutoCastVariants(bindingContext, dataFlowInfo, ((AutoCastReceiver) receiverToCast).getOriginal());
|
return getAutoCastVariantsExcludingReceiver(bindingContext, dataFlowInfo, ((AutoCastReceiver) receiverToCast).getOriginal());
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -134,7 +134,7 @@ public class TaskPrioritizer {
|
|||||||
boolean resolveInvoke
|
boolean resolveInvoke
|
||||||
) {
|
) {
|
||||||
|
|
||||||
List<ReceiverValue> variantsForExplicitReceiver = AutoCastUtils.getAutoCastVariantsIncludingReceiver(receiver, c.context);
|
List<ReceiverValue> variantsForExplicitReceiver = AutoCastUtils.getAutoCastVariants(receiver, c.context);
|
||||||
|
|
||||||
//members
|
//members
|
||||||
for (CallableDescriptorCollector<? extends D> callableDescriptorCollector : c.callableDescriptorCollectors) {
|
for (CallableDescriptorCollector<? extends D> callableDescriptorCollector : c.callableDescriptorCollectors) {
|
||||||
@@ -169,7 +169,7 @@ public class TaskPrioritizer {
|
|||||||
) {
|
) {
|
||||||
Collection<? extends D> memberExtensions = callableDescriptorCollector.getNonMembersByName(
|
Collection<? extends D> memberExtensions = callableDescriptorCollector.getNonMembersByName(
|
||||||
implicitReceiver.getType().getMemberScope(), c.name, c.context.trace);
|
implicitReceiver.getType().getMemberScope(), c.name, c.context.trace);
|
||||||
List<ReceiverValue> variantsForImplicitReceiver = AutoCastUtils.getAutoCastVariantsIncludingReceiver(implicitReceiver, c.context);
|
List<ReceiverValue> variantsForImplicitReceiver = AutoCastUtils.getAutoCastVariants(implicitReceiver, c.context);
|
||||||
c.result.addCandidates(convertWithReceivers(memberExtensions, variantsForImplicitReceiver,
|
c.result.addCandidates(convertWithReceivers(memberExtensions, variantsForImplicitReceiver,
|
||||||
variantsForExplicitReceiver, resolveInvoke));
|
variantsForExplicitReceiver, resolveInvoke));
|
||||||
}
|
}
|
||||||
@@ -249,7 +249,7 @@ public class TaskPrioritizer {
|
|||||||
@NotNull ReceiverValue explicitReceiver,
|
@NotNull ReceiverValue explicitReceiver,
|
||||||
@NotNull TaskPrioritizerContext<D, F> c
|
@NotNull TaskPrioritizerContext<D, F> c
|
||||||
) {
|
) {
|
||||||
List<ReceiverValue> variantsForExplicitReceiver = AutoCastUtils.getAutoCastVariantsIncludingReceiver(explicitReceiver, c.context);
|
List<ReceiverValue> variantsForExplicitReceiver = AutoCastUtils.getAutoCastVariants(explicitReceiver, c.context);
|
||||||
|
|
||||||
for (CallableDescriptorCollector<? extends D> callableDescriptorCollector : c.callableDescriptorCollectors) {
|
for (CallableDescriptorCollector<? extends D> callableDescriptorCollector : c.callableDescriptorCollectors) {
|
||||||
addMemberExtensionCandidates(variableReceiver, variantsForExplicitReceiver, callableDescriptorCollector, c, /*resolveInvoke=*/true);
|
addMemberExtensionCandidates(variableReceiver, variantsForExplicitReceiver, callableDescriptorCollector, c, /*resolveInvoke=*/true);
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ public final class TipsManager {
|
|||||||
info = DataFlowInfo.EMPTY;
|
info = DataFlowInfo.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ReceiverValue> variantsForExplicitReceiver = AutoCastUtils.getAutoCastVariantsIncludingReceiver(
|
List<ReceiverValue> variantsForExplicitReceiver = AutoCastUtils.getAutoCastVariants(receiverValue, context, info);
|
||||||
receiverValue, context, info);
|
|
||||||
|
|
||||||
for (ReceiverValue descriptor : variantsForExplicitReceiver) {
|
for (ReceiverValue descriptor : variantsForExplicitReceiver) {
|
||||||
descriptors.addAll(includeExternalCallableExtensions(
|
descriptors.addAll(includeExternalCallableExtensions(
|
||||||
|
|||||||
Reference in New Issue
Block a user