Skip to content

[sema] Change non-sendable -> non-Sendable in diagnostics. #81691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/AST/DiagnosticsClangImporter.def
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ GROUPED_WARNING(clang_swift_attr_unhandled, ClangDeclarationImport, none,
"ignoring unknown Swift attribute or modifier '%0'", (StringRef))

GROUPED_WARNING(clang_error_code_must_be_sendable, ClangDeclarationImport, none,
"cannot make error code type '%0' non-sendable because Swift errors "
"cannot make error code type '%0' non-Sendable because Swift errors "
"are always sendable", (StringRef))

GROUPED_WARNING(clang_ignored_sendable_attr, ClangDeclarationImport, none,
Expand Down
54 changes: 27 additions & 27 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -5008,28 +5008,28 @@ NOTE(silence_debug_description_in_interpolation_segment_call,none,
"use 'String(describing:)' to silence this warning", ())

NOTE(noescape_parameter,none,
"parameter %1 is implicitly %select{non-escaping|non-sendable}0",
"parameter %1 is implicitly %select{non-escaping|non-Sendable}0",
(unsigned, Identifier))
NOTE(generic_parameters_always_escaping,none,
"generic parameters are always considered '@escaping'", ())

ERROR(passing_noattrfunc_to_attrfunc,none,
"passing %select{non-escaping|non-sendable}0 parameter %1 to function "
"passing %select{non-escaping|non-Sendable}0 parameter %1 to function "
"expecting %select{an '@escaping'|a '@Sendable'}0 closure",
(unsigned, Identifier))
ERROR(converting_noescape_param_to_generic_type,none,
"converting non-escaping parameter %0 to generic parameter %1 may allow it to escape",
(Identifier, Type))
ERROR(assigning_noattrfunc_to_attrfunc,none,
"assigning %select{non-escaping|non-sendable}0 parameter %1 to "
"assigning %select{non-escaping|non-Sendable}0 parameter %1 to "
"%select{an '@escaping'|a '@Sendable'}0 closure",
(unsigned, Identifier))
ERROR(general_noattrfunc_to_attr,none,
"using %select{non-escaping|non-sendable}0 parameter %1 in a context "
"using %select{non-escaping|non-Sendable}0 parameter %1 in a context "
"expecting %select{an '@escaping'|a '@Sendable'}0 closure",
(unsigned, Identifier))
ERROR(converting_noattrfunc_to_type,none,
"converting %select{non-escaping|non-sendable function}0 value to %1 "
"converting %select{non-escaping|non-Sendable function}0 value to %1 "
"may %select{allow it to escape|introduce data races}0",
(unsigned, Type))
NOTE(escape_expected_at_parameter_position,none,
Expand Down Expand Up @@ -5672,15 +5672,15 @@ GROUPED_ERROR(concurrent_access_of_inout_param,SendableClosureCaptures,none,
"concurrently-executing code",
(DeclName))
GROUPED_ERROR(non_sendable_capture,SendableClosureCaptures,none,
"capture of %1 with non-sendable type %0 in a '@Sendable' "
"capture of %1 with non-Sendable type %0 in a '@Sendable' "
"%select{local function|closure}2",
(Type, DeclName, bool))
ERROR(non_sendable_isolated_capture,none,
"capture of %1 with non-sendable type %0 in an isolated "
"capture of %1 with non-Sendable type %0 in an isolated "
"%select{local function|closure}2",
(Type, DeclName, bool))
ERROR(non_sendable_metatype_capture,none,
"capture of non-sendable type %0 in an isolated "
"capture of non-Sendable type %0 in an isolated "
"%select{local function|closure}1",
(Type, bool))
ERROR(self_capture_deinit_task,none,
Expand Down Expand Up @@ -5817,77 +5817,77 @@ NOTE(in_derived_witness, none,
(const ValueDecl *, DeclName, Type))

ERROR(non_sendable_arg_into_actor,none,
"non-sendable type %0 cannot be sent into %2 context in call to %kind1",
"non-Sendable type %0 cannot be sent into %2 context in call to %kind1",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_arg_exits_actor,none,
"non-sendable type %0 cannot exit %2 context in call to nonisolated "
"non-Sendable type %0 cannot exit %2 context in call to nonisolated "
"%kind1",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_param_in_witness,none,
"non-sendable parameter type %0 cannot be sent from caller of "
"non-Sendable parameter type %0 cannot be sent from caller of "
"protocol requirement %1 into %2 implementation",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_param_in_override,none,
"non-sendable parameter type %0 cannot be sent from caller of "
"non-Sendable parameter type %0 cannot be sent from caller of "
"superclass %kind1 into %2 override",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_param_in_objc,none,
"non-sendable parameter type %0 of %2 '@objc' %kind1 cannot cross actor "
"non-Sendable parameter type %0 of %2 '@objc' %kind1 cannot cross actor "
"boundary",
(Type, const ValueDecl *, ActorIsolation))

ERROR(non_sendable_result_into_actor,none,
"non-sendable result type %0 cannot be sent from %2 context in call "
"non-Sendable result type %0 cannot be sent from %2 context in call "
"to %kind1",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_result_exits_actor,none,
"non-sendable result type %0 cannot exit %2 context in call to "
"non-Sendable result type %0 cannot exit %2 context in call to "
"nonisolated %kind1",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_result_in_witness,none,
"non-sendable type %0 cannot be returned from %2 implementation "
"non-Sendable type %0 cannot be returned from %2 implementation "
"to caller of protocol requirement %1",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_result_in_override,none,
"non-sendable type %0 cannot be returned from %2 override to "
"non-Sendable type %0 cannot be returned from %2 override to "
"caller of superclass %kind1",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_result_in_objc,none,
"non-sendable type %0 returned by %2 '@objc' %kind1 cannot cross "
"non-Sendable type %0 returned by %2 '@objc' %kind1 cannot cross "
"actor boundary",
(Type, const ValueDecl *, ActorIsolation))

ERROR(non_sendable_call_result_type,none,
"non-sendable result type %0 cannot be sent from %1 context in call "
"non-Sendable result type %0 cannot be sent from %1 context in call "
"to async function",
(Type, ActorIsolation))

ERROR(non_sendable_property_exits_actor,none,
"non-sendable type %0 of %kind1 cannot exit %2 context",
"non-Sendable type %0 of %kind1 cannot exit %2 context",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_property_into_actor,none,
"non-sendable type %0 of nonisolated %kind1 cannot be sent to "
"non-Sendable type %0 of nonisolated %kind1 cannot be sent to "
"%2 context",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_property_in_witness,none,
"non-sendable type %0 cannot be returned from %2 implementation "
"non-Sendable type %0 cannot be returned from %2 implementation "
"to caller of protocol requirement %1",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_property_in_override,none,
"non-sendable type %0 cannot be returned from %2 override to "
"non-Sendable type %0 cannot be returned from %2 override to "
"caller of superclass %kind1",
(Type, const ValueDecl *, ActorIsolation))
ERROR(non_sendable_property_in_objc,none,
"non-sendable type %0 returned by %2 '@objc' %kind1 cannot cross "
"non-Sendable type %0 returned by %2 '@objc' %kind1 cannot cross "
"actor boundary",
(Type, const ValueDecl *, ActorIsolation))

ERROR(non_sendable_keypath_capture,none,
"cannot form key path that captures non-sendable type %0",
"cannot form key path that captures non-Sendable type %0",
(Type))
ERROR(non_concurrent_type_member,none,
"%select{stored property %2|associated value %2}1 of "
"'Sendable'-conforming %kind3 has non-sendable type %0",
"'Sendable'-conforming %kind3 has non-Sendable type %0",
(Type, bool, DeclName, const ValueDecl *))
ERROR(concurrent_value_class_mutable_property,none,
"stored property %0 of 'Sendable'-conforming %kind1 is mutable",
Expand Down Expand Up @@ -5986,7 +5986,7 @@ ERROR(nonisolated_lazy,none,
())

ERROR(non_sendable_from_deinit,none,
"cannot access %kind1 with a non-sendable type %0 from nonisolated "
"cannot access %kind1 with a non-Sendable type %0 from nonisolated "
"deinit",
(Type, const VarDecl *))

Expand Down
2 changes: 1 addition & 1 deletion include/swift/Sema/Concurrency.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct DiagnosticBehavior;
/// that the attribute be removed.
void diagnoseUnnecessaryPreconcurrencyImports(SourceFile &sf);

/// Diagnose the use of an instance property of non-sendable type from an
/// Diagnose the use of an instance property of non-Sendable type from an
/// nonisolated deinitializer within an actor-isolated type.
///
/// \returns true iff a diagnostic was emitted for this reference.
Expand Down
10 changes: 5 additions & 5 deletions test/ClangImporter/objc_async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,22 @@ func testSendableAttrs(

doSomethingConcurrently {
print(sendableClass) // no-error
print(nonSendableClass) // expected-warning{{capture of 'nonSendableClass' with non-sendable type 'NonSendableClass' in a '@Sendable' closure}}
print(nonSendableClass) // expected-warning{{capture of 'nonSendableClass' with non-Sendable type 'NonSendableClass' in a '@Sendable' closure}}

print(sendableEnum) // no-error
print(nonSendableEnum) // expected-warning{{capture of 'nonSendableEnum' with non-sendable type 'NonSendableEnum' in a '@Sendable' closure}}
print(nonSendableEnum) // expected-warning{{capture of 'nonSendableEnum' with non-Sendable type 'NonSendableEnum' in a '@Sendable' closure}}

print(sendableOptions) // no-error
print(nonSendableOptions) // expected-warning{{capture of 'nonSendableOptions' with non-sendable type 'NonSendableOptions' in a '@Sendable' closure}}
print(nonSendableOptions) // expected-warning{{capture of 'nonSendableOptions' with non-Sendable type 'NonSendableOptions' in a '@Sendable' closure}}

print(sendableError) // no-error
print(nonSendableError) // no-error--we don't respect `@_nonSendable` on `ns_error_domain` types because all errors are Sendable

print(sendableStringEnum) // no-error
print(nonSendableStringEnum) // expected-warning{{capture of 'nonSendableStringEnum' with non-sendable type 'NonSendableStringEnum' in a '@Sendable' closure}}
print(nonSendableStringEnum) // expected-warning{{capture of 'nonSendableStringEnum' with non-Sendable type 'NonSendableStringEnum' in a '@Sendable' closure}}

print(sendableStringStruct) // no-error
print(nonSendableStringStruct) // expected-warning{{capture of 'nonSendableStringStruct' with non-sendable type 'NonSendableStringStruct' in a '@Sendable' closure}}
print(nonSendableStringStruct) // expected-warning{{capture of 'nonSendableStringStruct' with non-Sendable type 'NonSendableStringStruct' in a '@Sendable' closure}}
}
}

Expand Down
8 changes: 4 additions & 4 deletions test/Concurrency/actor_call_implicitly_async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ func someAsyncFunc() async {
////////////
// effectful properties from outside the actor instance

// expected-warning@+2 {{non-sendable type 'Box' of property 'effPropA' cannot exit actor-isolated context}}
// expected-warning@+2 {{non-Sendable type 'Box' of property 'effPropA' cannot exit actor-isolated context}}
// expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{property access is 'async'}}
_ = a.effPropA

// expected-warning@+3 {{non-sendable type 'Box' of property 'effPropT' cannot exit actor-isolated context}}
// expected-warning@+3 {{non-Sendable type 'Box' of property 'effPropT' cannot exit actor-isolated context}}
// expected-error@+2{{property access can throw, but it is not marked with 'try' and the error is not handled}}
// expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{property access is 'async'}}
_ = a.effPropT
Expand All @@ -190,8 +190,8 @@ func someAsyncFunc() async {
_ = a.effPropAT

// (mostly) corrected ones
_ = await a.effPropA // expected-warning {{non-sendable type 'Box' of property 'effPropA' cannot exit actor-isolated context}}
_ = try! await a.effPropT // expected-warning {{non-sendable type 'Box' of property 'effPropT' cannot exit actor-isolated context}}
_ = await a.effPropA // expected-warning {{non-Sendable type 'Box' of property 'effPropA' cannot exit actor-isolated context}}
_ = try! await a.effPropT // expected-warning {{non-Sendable type 'Box' of property 'effPropT' cannot exit actor-isolated context}}
_ = try? await a.effPropAT

print("ok!")
Expand Down
6 changes: 3 additions & 3 deletions test/Concurrency/actor_inout_isolation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extension TestActor {
func passStateIntoDifferentClassMethod() async {
let other = NonAsyncClass()
let otherCurry = other.modifyOtherAsync
// expected-targeted-complete-tns-warning @-1 {{non-sendable type 'NonAsyncClass' cannot exit actor-isolated context in call to nonisolated instance method 'modifyOtherAsync'}}
// expected-targeted-complete-tns-warning @-1 {{non-Sendable type 'NonAsyncClass' cannot exit actor-isolated context in call to nonisolated instance method 'modifyOtherAsync'}}
await other.modifyOtherAsync(&value2)
// expected-error @-1 {{actor-isolated property 'value2' cannot be passed 'inout' to 'async' function call}}

Expand Down Expand Up @@ -288,11 +288,11 @@ actor ProtectArray {
func test() async {
// FIXME: this is invalid too!
_ = await array.mutateAsynchronously
// expected-targeted-complete-tns-warning@-1 {{non-sendable type '@lvalue [Int]' cannot exit actor-isolated context in call to nonisolated property 'mutateAsynchronously'}}
// expected-targeted-complete-tns-warning@-1 {{non-Sendable type '@lvalue [Int]' cannot exit actor-isolated context in call to nonisolated property 'mutateAsynchronously'}}

_ = await array[mutateAsynchronously: 0]
// expected-error@-1 {{actor-isolated property 'array' cannot be passed 'inout' to 'async' function call}}
// expected-targeted-complete-tns-warning@-2 {{non-sendable type 'inout Array<Int>' cannot exit actor-isolated context in call to nonisolated subscript 'subscript(mutateAsynchronously:)'}}
// expected-targeted-complete-tns-warning@-2 {{non-Sendable type 'inout Array<Int>' cannot exit actor-isolated context in call to nonisolated subscript 'subscript(mutateAsynchronously:)'}}

await passToAsync(array[0])

Expand Down
Loading