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 @@ -887,6 +887,15 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
887
887
// FIXME: Along with the FIXME below, this is a hack to work around
888
888
// problems with restating requirements in protocols.
889
889
identical = false ;
890
+
891
+ if (auto anchor = overload.locator ->getAnchor ()) {
892
+ if (cs.containsIDEInspectionTarget (anchor)) {
893
+ // Don't rank based on overload choices of function calls that contain the
894
+ // code completion token.
895
+ continue ;
896
+ }
897
+ }
898
+
890
899
bool decl1InSubprotocol = false ;
891
900
bool decl2InSubprotocol = false ;
892
901
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