File tree Expand file tree Collapse file tree 3 files changed +17
-12
lines changed Expand file tree Collapse file tree 3 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -2818,6 +2818,10 @@ class ConstraintSystem {
28182818 // / Associate an argument list with a call at a given locator.
28192819 void associateArgumentList (ConstraintLocator *locator, ArgumentList *args);
28202820
2821+ // / If the given node is a function expression with a parent ApplyExpr,
2822+ // / returns the apply, otherwise returns the node itself.
2823+ ASTNode includingParentApply (ASTNode node);
2824+
28212825 std::optional<SelectedOverload>
28222826 findSelectedOverloadFor (ConstraintLocator *locator) const {
28232827 auto result = ResolvedOverloads.find (locator);
Original file line number Diff line number Diff line change @@ -1036,18 +1036,9 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
10361036 if (cs.isForCodeCompletion ()) {
10371037 // Don't rank based on overload choices of function calls that contain the
10381038 // code completion token.
1039- ASTNode anchor = simplifyLocatorToAnchor (overload.locator );
1040- if (auto expr = getAsExpr (anchor)) {
1041- // If the anchor is a called function, also don't rank overload choices
1042- // if any of the arguments contain the code completion token.
1043- if (auto apply = dyn_cast_or_null<ApplyExpr>(cs.getParentExpr (expr))) {
1044- if (apply->getFn () == expr) {
1045- anchor = apply;
1046- }
1047- }
1048- }
1049- if (anchor && cs.containsIDEInspectionTarget (anchor)) {
1050- continue ;
1039+ if (auto anchor = simplifyLocatorToAnchor (overload.locator )) {
1040+ if (cs.containsIDEInspectionTarget (cs.includingParentApply (anchor)))
1041+ continue ;
10511042 }
10521043 }
10531044
Original file line number Diff line number Diff line change @@ -6531,6 +6531,16 @@ static bool shouldHaveDirectCalleeOverload(const CallExpr *callExpr) {
65316531}
65326532#endif
65336533
6534+ ASTNode ConstraintSystem::includingParentApply (ASTNode node) {
6535+ if (auto *expr = getAsExpr (node)) {
6536+ if (auto apply = getAsExpr<ApplyExpr>(getParentExpr (expr))) {
6537+ if (apply->getFn () == expr)
6538+ return apply;
6539+ }
6540+ }
6541+ return node;
6542+ }
6543+
65346544Type Solution::resolveInterfaceType (Type type) const {
65356545 auto resolvedType = type.transform ([&](Type type) -> Type {
65366546 if (auto *tvt = type->getAs <TypeVariableType>()) {
You can’t perform that action at this time.
0 commit comments