File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -956,6 +956,25 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
956
956
// FIXME: Along with the FIXME below, this is a hack to work around
957
957
// problems with restating requirements in protocols.
958
958
identical = false ;
959
+
960
+ if (cs.Context .CompletionCallback ) {
961
+ // Don't rank based on overload choices of function calls that contain the
962
+ // code completion token.
963
+ ASTNode anchor = simplifyLocatorToAnchor (overload.locator );
964
+ if (auto expr = getAsExpr (anchor)) {
965
+ // If the anchor is a called function, also don't rank overload choices
966
+ // if any of the arguments contain the code completion token.
967
+ if (auto apply = dyn_cast_or_null<ApplyExpr>(cs.getParentExpr (expr))) {
968
+ if (apply->getFn () == expr) {
969
+ anchor = apply;
970
+ }
971
+ }
972
+ }
973
+ if (anchor && cs.containsIDEInspectionTarget (anchor)) {
974
+ continue ;
975
+ }
976
+ }
977
+
959
978
bool decl1InSubprotocol = false ;
960
979
bool decl2InSubprotocol = false ;
961
980
if (dc1->getContextKind () == DeclContextKind::GenericTypeDecl &&
Original file line number Diff line number Diff line change @@ -443,8 +443,8 @@ struct Struct123: Equatable {
443
443
}
444
444
func testBestSolutionFilter( ) {
445
445
let a = Struct123 ( ) ;
446
- let b = [ Struct123] ( ) . first ( where: { $0 == a && 1 + 90 * 5 / 8 == 45 * - 10 } ) ? . structMem != . #^BEST_SOLUTION_FILTER? xfail = rdar73282163 ^#
447
- let c = min ( 10.3 , 10 / 10.4 ) < 6 / 7 ? true : Optional ( a) ? . structMem != . #^BEST_SOLUTION_FILTER2 ? check= BEST_SOLUTION_FILTER;xfail = rdar73282163 ^#
446
+ let b = [ Struct123] ( ) . first ( where: { $0 == a && 1 + 90 * 5 / 8 == 45 * - 10 } ) ? . structMem != . #^BEST_SOLUTION_FILTER^#
447
+ let c = min ( 10.3 , 10 / 10.4 ) < 6 / 7 ? true : Optional ( a) ? . structMem != . #^BEST_SOLUTION_FILTER2 ? check= BEST_SOLUTION_FILTER^#
448
448
}
449
449
450
450
// BEST_SOLUTION_FILTER-DAG: Decl[EnumElement]/CurrNominal/Flair[ExprSpecific]/TypeRelation[Convertible]: enumElem[#Enum123#]{{; name=.+$}}
Original file line number Diff line number Diff line change @@ -485,3 +485,16 @@ func testReferenceToVariableDefinedInClosure() {
485
485
// VARIABLE_DEFINED_IN_CLOSURE: Decl[LocalVar]/Local: item[#String#]; name=item
486
486
}
487
487
488
+ func testBinaryOperatorWithEnum( ) {
489
+ func closureWithEnum( completionHandler: ( SomeEnum ) -> Void ) { }
490
+
491
+ closureWithEnum { foo in
492
+ if foo != . #^BINARY_OPERATOR_WITH_ENUM^# {
493
+ }
494
+ }
495
+ // BINARY_OPERATOR_WITH_ENUM: Begin completions
496
+ // BINARY_OPERATOR_WITH_ENUM-DAG: Decl[EnumElement]/CurrNominal/Flair[ExprSpecific]/TypeRelation[Convertible]: north[#SomeEnum#]
497
+ // BINARY_OPERATOR_WITH_ENUM-DAG: Decl[EnumElement]/CurrNominal/Flair[ExprSpecific]/TypeRelation[Convertible]: south[#SomeEnum#]
498
+ // BINARY_OPERATOR_WITH_ENUM: End completions
499
+
500
+ }
You can’t perform that action at this time.
0 commit comments