Skip to content

Commit 23b6b40

Browse files
committed
[Code completion] Fix incorrect addition of '{' in function builder results.
Noticed by Rintaro, thank you!
1 parent 591c8cd commit 23b6b40

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib/Sema/BuilderTransform.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1981,9 +1981,10 @@ void swift::printFunctionBuilderBuildFunction(
19811981
}
19821982

19831983
if (!printedResult)
1984-
printer << " -> " << componentTypeString << " {";
1984+
printer << " -> " << componentTypeString;
19851985

19861986
if (stubIndent) {
1987+
printer << " {";
19871988
printer.printNewline();
19881989
printer << " <#code#>";
19891990
printer.printNewline();

test/IDE/complete_function_builder.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ struct AnyBuilder {
103103
}
104104

105105
// IN_FUNCTION_BUILDER_DECL: Begin completions, 8 items
106-
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildBlock(_ components: Any...) -> Any { {|}; name=buildBlock(_ components: Any...) -> Any {; comment=Required by every
107-
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildExpression(_ expression: <#Expression#>) -> Any { {|}; name=buildExpression(_ expression: <#Expression#>) -> Any {; comment=
108-
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildOptional(_ component: Any?) -> Any { {|}; name=buildOptional(_ component: Any?) -> Any {; comment=
109-
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildEither(first component: Any) -> Any { {|}; name=buildEither(first component: Any) -> Any {; comment=
110-
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildEither(second component: Any) -> Any { {|}; name=buildEither(second component: Any) -> Any {; comment=
111-
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildArray(_ components: [Any]) -> Any { {|}; name=buildArray(_ components: [Any]) -> Any {; comment=
112-
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildLimitedAvailability(_ component: Any) -> Any { {|}; name=buildLimitedAvailability(_ component: Any) -> Any {; comment=
106+
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildBlock(_ components: Any...) -> Any {|}; name=buildBlock(_ components: Any...) -> Any; comment=Required by every
107+
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildExpression(_ expression: <#Expression#>) -> Any {|}; name=buildExpression(_ expression: <#Expression#>) -> Any; comment=
108+
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildOptional(_ component: Any?) -> Any {|}; name=buildOptional(_ component: Any?) -> Any; comment=
109+
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildEither(first component: Any) -> Any {|}; name=buildEither(first component: Any) -> Any; comment=
110+
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildEither(second component: Any) -> Any {|}; name=buildEither(second component: Any) -> Any; comment=
111+
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildArray(_ components: [Any]) -> Any {|}; name=buildArray(_ components: [Any]) -> Any; comment=
112+
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildLimitedAvailability(_ component: Any) -> Any {|}; name=buildLimitedAvailability(_ component: Any) -> Any; comment=
113113
// IN_FUNCTION_BUILDER_DECL: Pattern/CurrNominal: buildFinalResult(_ component: Any) -> <#Result#> {|}; name=buildFinalResult(_ component: Any) -> <#Result#>; comment=
114114
// IN_FUNCTION_BUILDER_DECL: End completions

0 commit comments

Comments
 (0)