Skip to content

Commit 0d568a9

Browse files
committed
[SE-0289] Update diagnostics & many other strings to "result builders"
1 parent 6a40a3a commit 0d568a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+330
-330
lines changed

docs/LibraryEvolution.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ No other changes are permitted; the following are particularly of note:
159159
not they have default arguments.
160160
- An ABI-public function that throws may not become non-throwing or vice versa.
161161
- The ``@escaping`` attribute may not be added to or removed from a parameter.
162-
- Adding or removing a function builder from a parameter is a
162+
- Adding or removing a result builder from a parameter is a
163163
`binary-compatible source-breaking change`.
164164

165165

include/swift/AST/Attr.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ SIMPLE_DECL_ATTR(_disfavoredOverload, DisfavoredOverload,
493493
OnAbstractFunction | OnVar | OnSubscript | UserInaccessible |
494494
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
495495
87)
496-
SIMPLE_DECL_ATTR(resultBuilder, FunctionBuilder,
496+
SIMPLE_DECL_ATTR(resultBuilder, ResultBuilder,
497497
OnNominalType |
498498
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
499499
88)

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,7 @@ class ValueDecl : public Decl {
24022402
OpaqueReturnTypeRepr *getOpaqueResultTypeRepr() const;
24032403

24042404
/// Retrieve the attribute associating this declaration with a
2405-
/// function builder, if there is one.
2405+
/// result builder, if there is one.
24062406
CustomAttr *getAttachedFunctionBuilder() const;
24072407

24082408
/// Retrieve the @functionBuilder type attached to this declaration,

include/swift/AST/DiagnosticsSema.def

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5352,83 +5352,83 @@ ERROR(property_wrapper_missing_arg_init, none, "missing argument for parameter "
53525352
"arguments in '@%1(...)'", (Identifier, StringRef))
53535353

53545354
//------------------------------------------------------------------------------
5355-
// MARK: function builder diagnostics
5355+
// MARK: result builder diagnostics
53565356
//------------------------------------------------------------------------------
5357-
ERROR(function_builder_decl, none,
5358-
"closure containing a declaration cannot be used with function "
5357+
ERROR(result_builder_decl, none,
5358+
"closure containing a declaration cannot be used with result "
53595359
"builder %0", (DeclName))
5360-
NOTE(note_function_builder_decl, none,
5361-
"closure containing a declaration cannot be used with function "
5360+
NOTE(note_result_builder_decl, none,
5361+
"closure containing a declaration cannot be used with result "
53625362
"builder %0", (DeclName))
5363-
ERROR(function_builder_control_flow, none,
5364-
"closure containing control flow statement cannot be used with function "
5363+
ERROR(result_builder_control_flow, none,
5364+
"closure containing control flow statement cannot be used with result "
53655365
"builder %0", (DeclName))
5366-
NOTE(note_function_builder_control_flow, none,
5367-
"closure containing control flow statement cannot be used with function "
5366+
NOTE(note_result_builder_control_flow, none,
5367+
"closure containing control flow statement cannot be used with result "
53685368
"builder %0", (DeclName))
5369-
ERROR(function_builder_attribute_not_allowed_here, none,
5370-
"function builder attribute %0 can only be applied to a parameter, "
5369+
ERROR(result_builder_attribute_not_allowed_here, none,
5370+
"result builder attribute %0 can only be applied to a parameter, "
53715371
"function, or computed property", (Identifier))
5372-
ERROR(function_builder_attribute_on_storage_without_getter, none,
5373-
"function builder attribute %0 can only be applied to a "
5372+
ERROR(result_builder_attribute_on_storage_without_getter, none,
5373+
"result builder attribute %0 can only be applied to a "
53745374
"%select{subscript|property|constant|variable}1 if it defines a getter",
53755375
(DeclName, unsigned))
5376-
ERROR(function_builder_parameter_not_of_function_type, none,
5377-
"function builder attribute %0 can only be applied to a parameter of "
5376+
ERROR(result_builder_parameter_not_of_function_type, none,
5377+
"result builder attribute %0 can only be applied to a parameter of "
53785378
"function type",
53795379
(Identifier))
5380-
ERROR(function_builder_parameter_autoclosure, none,
5381-
"function builder attribute %0 cannot be applied to an autoclosure "
5380+
ERROR(result_builder_parameter_autoclosure, none,
5381+
"result builder attribute %0 cannot be applied to an autoclosure "
53825382
"parameter",
53835383
(Identifier))
5384-
ERROR(function_builder_multiple, none,
5385-
"only one function builder attribute can be attached to a "
5384+
ERROR(result_builder_multiple, none,
5385+
"only one result builder attribute can be attached to a "
53865386
"%select{declaration|parameter}0", (bool))
5387-
NOTE(previous_function_builder_here, none,
5388-
"previous function builder specified here", ())
5389-
ERROR(function_builder_arguments, none,
5390-
"function builder attributes cannot have arguments", ())
5391-
WARNING(function_builder_disabled_by_return, none,
5392-
"application of function builder %0 disabled by explicit 'return' "
5387+
NOTE(previous_result_builder_here, none,
5388+
"previous result builder specified here", ())
5389+
ERROR(result_builder_arguments, none,
5390+
"result builder attributes cannot have arguments", ())
5391+
WARNING(result_builder_disabled_by_return, none,
5392+
"application of result builder %0 disabled by explicit 'return' "
53935393
"statement", (Type))
5394-
NOTE(function_builder_remove_attr, none,
5395-
"remove the attribute to explicitly disable the function builder", ())
5396-
NOTE(function_builder_remove_returns, none,
5397-
"remove 'return' statements to apply the function builder", ())
5398-
ERROR(function_builder_infer_ambig, none,
5399-
"ambiguous function builder inferred for %0: %1 or %2",
5394+
NOTE(result_builder_remove_attr, none,
5395+
"remove the attribute to explicitly disable the result builder", ())
5396+
NOTE(result_builder_remove_returns, none,
5397+
"remove 'return' statements to apply the result builder", ())
5398+
ERROR(result_builder_infer_ambig, none,
5399+
"ambiguous result builder inferred for %0: %1 or %2",
54005400
(DeclName, Type, Type))
5401-
NOTE(function_builder_infer_add_return, none,
5402-
"add an explicit 'return' statement to not use a function builder", ())
5403-
NOTE(function_builder_infer_pick_specific, none,
5404-
"apply function builder %0 (inferred from %select{protocol|dynamic replacement of}1 %2)",
5401+
NOTE(result_builder_infer_add_return, none,
5402+
"add an explicit 'return' statement to not use a result builder", ())
5403+
NOTE(result_builder_infer_pick_specific, none,
5404+
"apply result builder %0 (inferred from %select{protocol|dynamic replacement of}1 %2)",
54055405
(Type, unsigned, DeclName))
5406-
WARNING(function_builder_missing_limited_availability, none,
5407-
"function builder %0 does not implement 'buildLimitedAvailability'; "
5406+
WARNING(result_builder_missing_limited_availability, none,
5407+
"result builder %0 does not implement 'buildLimitedAvailability'; "
54085408
"this code may crash on earlier versions of the OS",
54095409
(Type))
5410-
ERROR(function_builder_static_buildblock, none,
5411-
"function builder must provide at least one static 'buildBlock' "
5410+
ERROR(result_builder_static_buildblock, none,
5411+
"result builder must provide at least one static 'buildBlock' "
54125412
"method", ())
5413-
NOTE(function_builder_non_static_buildblock, none,
5413+
NOTE(result_builder_non_static_buildblock, none,
54145414
"did you mean to make instance method 'buildBlock' static?", ())
5415-
NOTE(function_builder_buildblock_enum_case, none,
5416-
"enum case 'buildBlock' cannot be used to satisfy the function builder "
5415+
NOTE(result_builder_buildblock_enum_case, none,
5416+
"enum case 'buildBlock' cannot be used to satisfy the result builder "
54175417
"requirement", ())
5418-
NOTE(function_builder_buildblock_not_static_method, none,
5418+
NOTE(result_builder_buildblock_not_static_method, none,
54195419
"potential match 'buildBlock' is not a static method", ())
54205420

5421-
NOTE(function_builder_missing_build_optional, none,
5422-
"add 'buildOptional(_:)' to the function builder %0 to add support for "
5421+
NOTE(result_builder_missing_build_optional, none,
5422+
"add 'buildOptional(_:)' to the result builder %0 to add support for "
54235423
"'if' statements without an 'else'", (Type))
5424-
NOTE(function_builder_missing_build_either, none,
5425-
"add 'buildEither(first:)' and 'buildEither(second:)' to the function "
5424+
NOTE(result_builder_missing_build_either, none,
5425+
"add 'buildEither(first:)' and 'buildEither(second:)' to the result "
54265426
"builder %0 to add support for 'if'-'else' and 'switch'", (Type))
5427-
NOTE(function_builder_missing_build_array, none,
5428-
"add 'buildArray(_:)' to the function builder %0 to add support for "
5427+
NOTE(result_builder_missing_build_array, none,
5428+
"add 'buildArray(_:)' to the result builder %0 to add support for "
54295429
"'for'..'in' loops", (Type))
5430-
NOTE(function_builder_missing_build_limited_availability, none,
5431-
"add 'buildLimitedAvailability(_:)' to the function "
5430+
NOTE(result_builder_missing_build_limited_availability, none,
5431+
"add 'buildLimitedAvailability(_:)' to the result "
54325432
"builder %0 to erase type information for less-available types", (Type))
54335433

54345434
//------------------------------------------------------------------------------

include/swift/AST/EducationalNotes.def

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ EDUCATIONAL_NOTES(type_cannot_conform, "protocol-type-non-conformance.md")
8181
EDUCATIONAL_NOTES(unlabeled_trailing_closure_deprecated,
8282
"trailing-closure-matching.md")
8383

84-
EDUCATIONAL_NOTES(function_builder_static_buildblock,
84+
EDUCATIONAL_NOTES(result_builder_static_buildblock,
8585
"function-builder-methods.md")
86-
EDUCATIONAL_NOTES(function_builder_missing_limited_availability,
86+
EDUCATIONAL_NOTES(result_builder_missing_limited_availability,
8787
"function-builder-methods.md")
88-
EDUCATIONAL_NOTES(function_builder_missing_build_optional,
88+
EDUCATIONAL_NOTES(result_builder_missing_build_optional,
8989
"function-builder-methods.md")
90-
EDUCATIONAL_NOTES(function_builder_missing_build_either,
90+
EDUCATIONAL_NOTES(result_builder_missing_build_either,
9191
"function-builder-methods.md")
92-
EDUCATIONAL_NOTES(function_builder_missing_build_array,
92+
EDUCATIONAL_NOTES(result_builder_missing_build_array,
9393
"function-builder-methods.md")
9494

9595
#undef EDUCATIONAL_NOTES

include/swift/AST/Expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3695,7 +3695,7 @@ class ClosureExpr : public AbstractClosureExpr {
36953695
ReadyForTypeChecking,
36963696

36973697
/// The body was typechecked with the enclosing closure.
3698-
/// i.e. single expression closure or function builder closure.
3698+
/// i.e. single expression closure or result builder closure.
36993699
TypeCheckedWithSignature,
37003700

37013701
/// The body was type checked separately from the enclosing closure.

include/swift/AST/TypeCheckRequests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ void simple_display(llvm::raw_ostream &out, FragileFunctionKind value);
735735

736736
void simple_display(llvm::raw_ostream &out, ResilienceExpansion value);
737737

738-
/// Request the custom attribute which attaches a function builder to the
738+
/// Request the custom attribute which attaches a result builder to the
739739
/// given declaration.
740740
class AttachedFunctionBuilderRequest :
741741
public SimpleRequest<AttachedFunctionBuilderRequest,
@@ -756,7 +756,7 @@ class AttachedFunctionBuilderRequest :
756756
bool isCached() const;
757757
};
758758

759-
/// Request the function builder type attached to the given declaration,
759+
/// Request the result builder type attached to the given declaration,
760760
/// if any.
761761
class FunctionBuilderTypeRequest :
762762
public SimpleRequest<FunctionBuilderTypeRequest,

include/swift/Sema/CSFix.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ enum class FixKind : uint8_t {
194194

195195
/// Skip any unhandled constructs that occur within a closure argument that
196196
/// matches up with a
197-
/// parameter that has a function builder.
197+
/// parameter that has a result builder.
198198
SkipUnhandledConstructInFunctionBuilder,
199199

200200
/// Allow invalid reference to a member declared as `mutating`
@@ -277,7 +277,7 @@ enum class FixKind : uint8_t {
277277
/// Allow key path expressions with no components.
278278
AllowKeyPathWithoutComponents,
279279

280-
/// Ignore function builder body which fails `pre-check` call.
280+
/// Ignore result builder body which fails `pre-check` call.
281281
IgnoreInvalidFunctionBuilderBody,
282282

283283
/// Resolve type of `nil` by providing a contextual type.
@@ -1518,7 +1518,7 @@ class SkipUnhandledConstructInFunctionBuilder final : public ConstraintFix {
15181518

15191519
public:
15201520
std::string getName() const override {
1521-
return "skip unhandled constructs when applying a function builder";
1521+
return "skip unhandled constructs when applying a result builder";
15221522
}
15231523

15241524
bool diagnose(const Solution &solution, bool asNote = false) const override;
@@ -2012,7 +2012,7 @@ class IgnoreInvalidFunctionBuilderBody final : public ConstraintFix {
20122012

20132013
public:
20142014
std::string getName() const override {
2015-
return "ignore invalid function builder body";
2015+
return "ignore invalid result builder body";
20162016
}
20172017

20182018
bool diagnose(const Solution &solution, bool asNote = false) const override;

include/swift/Sema/ConstraintLocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class ConstraintLocator : public llvm::FoldingSetNode {
222222
/// Determine whether this locator points to the `try?` expression.
223223
bool isForOptionalTry() const;
224224

225-
/// Determine whether this locator is for a function builder body result type.
225+
/// Determine whether this locator is for a result builder body result type.
226226
bool isForFunctionBuilderBodyResult() const;
227227

228228
/// Determine whether this locator points directly to a given expression.

include/swift/Sema/ConstraintLocatorPathElts.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ SIMPLE_LOCATOR_PATH_ELT(FunctionArgument)
7575
/// The result type of a function.
7676
SIMPLE_LOCATOR_PATH_ELT(FunctionResult)
7777

78-
/// The result type of a function builder body.
78+
/// The result type of a result builder body.
7979
SIMPLE_LOCATOR_PATH_ELT(FunctionBuilderBodyResult)
8080

8181
/// A generic argument.

0 commit comments

Comments
 (0)