Skip to content

Commit 3c09829

Browse files
authored
Merge pull request #70899 from ahoppen/ahoppen/5.10/rdar120798355
[5.10][CodeCompletion] Fix issue in which parts of a result builder were incorrectly skipped
2 parents 40d7a1f + e64ec00 commit 3c09829

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

lib/Sema/BuilderTransform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ class ResultBuilderTransform
227227
buildBlockArguments);
228228
}
229229
if (builder.supports(ctx.Id_buildExpression)) {
230-
expr = builder.buildCall(expr->getLoc(), ctx.Id_buildExpression, {expr},
231-
{Identifier()});
230+
expr = builder.buildCall(expr->getStartLoc(), ctx.Id_buildExpression,
231+
{expr}, {Identifier()});
232232
}
233233

234234
if (isa<CodeCompletionExpr>(expr)) {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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 test() {
5+
MyStack {
6+
MyStack {
7+
}
8+
.pnTapGesture {
9+
#^COMPLETE^#
10+
}
11+
.everlay() {
12+
}
13+
}
14+
}
15+
16+
struct MyView {
17+
func everlay(content: () -> Void) -> MyView { MyView() }
18+
}
19+
20+
struct MyStack {
21+
init(@WiewBuilder content: () -> MyView) {}
22+
func pnTapGesture(perform action: () -> Void) -> MyView { MyView() }
23+
}
24+
25+
@resultBuilder
26+
struct WiewBuilder {
27+
static func buildExpression(_ content: MyView) -> MyView { content }
28+
static func buildBlock(_ content: MyView) -> MyView { content }
29+
static func buildBlock() -> MyView { MyView() }
30+
}
31+
32+
// COMPLETE: Decl[FreeFunction]/CurrModule: test()[#Void#]

0 commit comments

Comments
 (0)