File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -883,6 +883,13 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
883
883
// FIXME: Along with the FIXME below, this is a hack to work around
884
884
// problems with restating requirements in protocols.
885
885
identical = false ;
886
+
887
+ if (cs.containsIDEInspectionTarget (overload.locator ->getAnchor ())) {
888
+ // Don't rank based on overload choices of function calls that contain the
889
+ // code completion token.
890
+ continue ;
891
+ }
892
+
886
893
bool decl1InSubprotocol = false ;
887
894
bool decl2InSubprotocol = false ;
888
895
if (dc1->getContextKind () == DeclContextKind::GenericTypeDecl &&
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t
3
+
4
+ func buildView< T> ( @MyViewBuilder _ x: ( ) -> T ) { }
5
+
6
+ @resultBuilder struct MyViewBuilder {
7
+ static func buildBlock( _ content: MyText ) -> MyText { content }
8
+ }
9
+
10
+ struct MyText : Equatable {
11
+ init ( verbatim content: String ) { }
12
+ init < S> ( _ content: S ) where S : StringProtocol { }
13
+ }
14
+
15
+ func test( text: String ) {
16
+ buildView {
17
+ MyText ( #^COMPLETE^#text)
18
+ }
19
+ }
20
+
21
+ // COMPLETE: Begin completions
22
+ // COMPLETE-DAG: Decl[Constructor]/CurrNominal/Flair[ArgLabels]/TypeRelation[Convertible]: ['(']{#verbatim: String#}[')'][#MyText#];
23
+ // COMPLETE-DAG: Decl[Constructor]/CurrNominal/Flair[ArgLabels]/TypeRelation[Convertible]: ['(']{#(content): StringProtocol#}[')'][#MyText#];
24
+ // COMPLETE-DAG: Decl[LocalVar]/Local/TypeRelation[Convertible]: text[#String#];
25
+ // COMPLETE: End completions
You can’t perform that action at this time.
0 commit comments