File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ SourceRange ASTNode::getSourceRange() const {
41
41
if (const auto *I = this ->dyn_cast <CaseLabelItem *>()) {
42
42
return I->getSourceRange ();
43
43
}
44
+ assert (!isNull () && " Null ASTNode doesn't have a source range" );
44
45
llvm_unreachable (" unsupported AST node" );
45
46
}
46
47
Original file line number Diff line number Diff line change @@ -906,6 +906,15 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
906
906
// FIXME: Along with the FIXME below, this is a hack to work around
907
907
// problems with restating requirements in protocols.
908
908
identical = false ;
909
+
910
+ if (auto anchor = overload.locator ->getAnchor ()) {
911
+ if (cs.containsIDEInspectionTarget (anchor)) {
912
+ // Don't rank based on overload choices of function calls that contain the
913
+ // code completion token.
914
+ continue ;
915
+ }
916
+ }
917
+
909
918
bool decl1InSubprotocol = false ;
910
919
bool decl2InSubprotocol = false ;
911
920
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