Skip to content

Commit 0d519a1

Browse files
committed
[sema] Change non-sendable -> non-Sendable in diagnostics.
This matches send non sendable but importantly also makes it clear that we are talking about something that doesn't conform to the Sendable protocol which is capitalized. rdar://151802975 (cherry picked from commit 3ed4059)
1 parent 7077ef5 commit 0d519a1

File tree

54 files changed

+554
-554
lines changed

Some content is hidden

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

54 files changed

+554
-554
lines changed

include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ GROUPED_WARNING(clang_swift_attr_unhandled, ClangDeclarationImport, none,
9292
"ignoring unknown Swift attribute or modifier '%0'", (StringRef))
9393

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

9898
GROUPED_WARNING(clang_ignored_sendable_attr, ClangDeclarationImport, none,

include/swift/AST/DiagnosticsSema.def

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4988,28 +4988,28 @@ NOTE(silence_debug_description_in_interpolation_segment_call,none,
49884988
"use 'String(describing:)' to silence this warning", ())
49894989

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

49964996
ERROR(passing_noattrfunc_to_attrfunc,none,
4997-
"passing %select{non-escaping|non-sendable}0 parameter %1 to function "
4997+
"passing %select{non-escaping|non-Sendable}0 parameter %1 to function "
49984998
"expecting %select{an '@escaping'|a '@Sendable'}0 closure",
49994999
(unsigned, Identifier))
50005000
ERROR(converting_noescape_param_to_generic_type,none,
50015001
"converting non-escaping parameter %0 to generic parameter %1 may allow it to escape",
50025002
(Identifier, Type))
50035003
ERROR(assigning_noattrfunc_to_attrfunc,none,
5004-
"assigning %select{non-escaping|non-sendable}0 parameter %1 to "
5004+
"assigning %select{non-escaping|non-Sendable}0 parameter %1 to "
50055005
"%select{an '@escaping'|a '@Sendable'}0 closure",
50065006
(unsigned, Identifier))
50075007
ERROR(general_noattrfunc_to_attr,none,
5008-
"using %select{non-escaping|non-sendable}0 parameter %1 in a context "
5008+
"using %select{non-escaping|non-Sendable}0 parameter %1 in a context "
50095009
"expecting %select{an '@escaping'|a '@Sendable'}0 closure",
50105010
(unsigned, Identifier))
50115011
ERROR(converting_noattrfunc_to_type,none,
5012-
"converting %select{non-escaping|non-sendable function}0 value to %1 "
5012+
"converting %select{non-escaping|non-Sendable function}0 value to %1 "
50135013
"may %select{allow it to escape|introduce data races}0",
50145014
(unsigned, Type))
50155015
NOTE(escape_expected_at_parameter_position,none,
@@ -5652,15 +5652,15 @@ GROUPED_ERROR(concurrent_access_of_inout_param,SendableClosureCaptures,none,
56525652
"concurrently-executing code",
56535653
(DeclName))
56545654
GROUPED_ERROR(non_sendable_capture,SendableClosureCaptures,none,
5655-
"capture of %1 with non-sendable type %0 in a '@Sendable' "
5655+
"capture of %1 with non-Sendable type %0 in a '@Sendable' "
56565656
"%select{local function|closure}2",
56575657
(Type, DeclName, bool))
56585658
ERROR(non_sendable_isolated_capture,none,
5659-
"capture of %1 with non-sendable type %0 in an isolated "
5659+
"capture of %1 with non-Sendable type %0 in an isolated "
56605660
"%select{local function|closure}2",
56615661
(Type, DeclName, bool))
56625662
ERROR(non_sendable_metatype_capture,none,
5663-
"capture of non-sendable type %0 in an isolated "
5663+
"capture of non-Sendable type %0 in an isolated "
56645664
"%select{local function|closure}1",
56655665
(Type, bool))
56665666
ERROR(self_capture_deinit_task,none,
@@ -5796,77 +5796,77 @@ NOTE(in_derived_witness, none,
57965796
(DescriptiveDeclKind, DeclName, Type))
57975797

57985798
ERROR(non_sendable_arg_into_actor,none,
5799-
"non-sendable type %0 cannot be sent into %2 context in call to %kind1",
5799+
"non-Sendable type %0 cannot be sent into %2 context in call to %kind1",
58005800
(Type, const ValueDecl *, ActorIsolation))
58015801
ERROR(non_sendable_arg_exits_actor,none,
5802-
"non-sendable type %0 cannot exit %2 context in call to nonisolated "
5802+
"non-Sendable type %0 cannot exit %2 context in call to nonisolated "
58035803
"%kind1",
58045804
(Type, const ValueDecl *, ActorIsolation))
58055805
ERROR(non_sendable_param_in_witness,none,
5806-
"non-sendable parameter type %0 cannot be sent from caller of "
5806+
"non-Sendable parameter type %0 cannot be sent from caller of "
58075807
"protocol requirement %1 into %2 implementation",
58085808
(Type, const ValueDecl *, ActorIsolation))
58095809
ERROR(non_sendable_param_in_override,none,
5810-
"non-sendable parameter type %0 cannot be sent from caller of "
5810+
"non-Sendable parameter type %0 cannot be sent from caller of "
58115811
"superclass %kind1 into %2 override",
58125812
(Type, const ValueDecl *, ActorIsolation))
58135813
ERROR(non_sendable_param_in_objc,none,
5814-
"non-sendable parameter type %0 of %2 '@objc' %kind1 cannot cross actor "
5814+
"non-Sendable parameter type %0 of %2 '@objc' %kind1 cannot cross actor "
58155815
"boundary",
58165816
(Type, const ValueDecl *, ActorIsolation))
58175817

58185818
ERROR(non_sendable_result_into_actor,none,
5819-
"non-sendable result type %0 cannot be sent from %2 context in call "
5819+
"non-Sendable result type %0 cannot be sent from %2 context in call "
58205820
"to %kind1",
58215821
(Type, const ValueDecl *, ActorIsolation))
58225822
ERROR(non_sendable_result_exits_actor,none,
5823-
"non-sendable result type %0 cannot exit %2 context in call to "
5823+
"non-Sendable result type %0 cannot exit %2 context in call to "
58245824
"nonisolated %kind1",
58255825
(Type, const ValueDecl *, ActorIsolation))
58265826
ERROR(non_sendable_result_in_witness,none,
5827-
"non-sendable type %0 cannot be returned from %2 implementation "
5827+
"non-Sendable type %0 cannot be returned from %2 implementation "
58285828
"to caller of protocol requirement %1",
58295829
(Type, const ValueDecl *, ActorIsolation))
58305830
ERROR(non_sendable_result_in_override,none,
5831-
"non-sendable type %0 cannot be returned from %2 override to "
5831+
"non-Sendable type %0 cannot be returned from %2 override to "
58325832
"caller of superclass %kind1",
58335833
(Type, const ValueDecl *, ActorIsolation))
58345834
ERROR(non_sendable_result_in_objc,none,
5835-
"non-sendable type %0 returned by %2 '@objc' %kind1 cannot cross "
5835+
"non-Sendable type %0 returned by %2 '@objc' %kind1 cannot cross "
58365836
"actor boundary",
58375837
(Type, const ValueDecl *, ActorIsolation))
58385838

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

58445844
ERROR(non_sendable_property_exits_actor,none,
5845-
"non-sendable type %0 of %kind1 cannot exit %2 context",
5845+
"non-Sendable type %0 of %kind1 cannot exit %2 context",
58465846
(Type, const ValueDecl *, ActorIsolation))
58475847
ERROR(non_sendable_property_into_actor,none,
5848-
"non-sendable type %0 of nonisolated %kind1 cannot be sent to "
5848+
"non-Sendable type %0 of nonisolated %kind1 cannot be sent to "
58495849
"%2 context",
58505850
(Type, const ValueDecl *, ActorIsolation))
58515851
ERROR(non_sendable_property_in_witness,none,
5852-
"non-sendable type %0 cannot be returned from %2 implementation "
5852+
"non-Sendable type %0 cannot be returned from %2 implementation "
58535853
"to caller of protocol requirement %1",
58545854
(Type, const ValueDecl *, ActorIsolation))
58555855
ERROR(non_sendable_property_in_override,none,
5856-
"non-sendable type %0 cannot be returned from %2 override to "
5856+
"non-Sendable type %0 cannot be returned from %2 override to "
58575857
"caller of superclass %kind1",
58585858
(Type, const ValueDecl *, ActorIsolation))
58595859
ERROR(non_sendable_property_in_objc,none,
5860-
"non-sendable type %0 returned by %2 '@objc' %kind1 cannot cross "
5860+
"non-Sendable type %0 returned by %2 '@objc' %kind1 cannot cross "
58615861
"actor boundary",
58625862
(Type, const ValueDecl *, ActorIsolation))
58635863

58645864
ERROR(non_sendable_keypath_capture,none,
5865-
"cannot form key path that captures non-sendable type %0",
5865+
"cannot form key path that captures non-Sendable type %0",
58665866
(Type))
58675867
ERROR(non_concurrent_type_member,none,
58685868
"%select{stored property %2|associated value %2}1 of "
5869-
"'Sendable'-conforming %kind3 has non-sendable type %0",
5869+
"'Sendable'-conforming %kind3 has non-Sendable type %0",
58705870
(Type, bool, DeclName, const ValueDecl *))
58715871
ERROR(concurrent_value_class_mutable_property,none,
58725872
"stored property %0 of 'Sendable'-conforming %kind1 is mutable",

include/swift/Sema/Concurrency.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct DiagnosticBehavior;
3636
/// that the attribute be removed.
3737
void diagnoseUnnecessaryPreconcurrencyImports(SourceFile &sf);
3838

39-
/// Diagnose the use of an instance property of non-sendable type from an
39+
/// Diagnose the use of an instance property of non-Sendable type from an
4040
/// nonisolated deinitializer within an actor-isolated type.
4141
///
4242
/// \returns true iff a diagnostic was emitted for this reference.

test/ClangImporter/objc_async.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,22 +137,22 @@ func testSendableAttrs(
137137

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

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

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

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

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

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

test/Concurrency/actor_call_implicitly_async.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func someAsyncFunc() async {
180180
// expected-error@+1{{actor-isolated property 'effPropA' cannot be accessed from outside of the actor}} {{7-7=await }}
181181
_ = a.effPropA
182182

183-
// expected-warning@+3 {{non-sendable type 'Box' of property 'effPropT' cannot exit actor-isolated context}}
183+
// expected-warning@+3 {{non-Sendable type 'Box' of property 'effPropT' cannot exit actor-isolated context}}
184184
// expected-error@+2{{property access can throw, but it is not marked with 'try' and the error is not handled}}
185185
// expected-error@+1{{actor-isolated property 'effPropT' cannot be accessed from outside of the actor}} {{7-7=await }}
186186
_ = a.effPropT
@@ -190,8 +190,8 @@ func someAsyncFunc() async {
190190
_ = a.effPropAT
191191

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

197197
print("ok!")

test/Concurrency/actor_inout_isolation.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ extension TestActor {
119119
func passStateIntoDifferentClassMethod() async {
120120
let other = NonAsyncClass()
121121
let otherCurry = other.modifyOtherAsync
122-
// expected-targeted-complete-tns-warning @-1 {{non-sendable type 'NonAsyncClass' cannot exit actor-isolated context in call to nonisolated instance method 'modifyOtherAsync'}}
122+
// expected-targeted-complete-tns-warning @-1 {{non-Sendable type 'NonAsyncClass' cannot exit actor-isolated context in call to nonisolated instance method 'modifyOtherAsync'}}
123123
await other.modifyOtherAsync(&value2)
124124
// expected-error @-1 {{actor-isolated property 'value2' cannot be passed 'inout' to 'async' function call}}
125125

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

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

297297
await passToAsync(array[0])
298298

test/Concurrency/actor_isolation.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,20 @@ func checkIsolationValueType(_ formance: InferredFromConformance,
155155
_ ext: InferredFromContext,
156156
_ anno: NoGlobalActorValueType) async {
157157
// these still do need an await in Swift 5
158-
_ = await ext.point // expected-warning {{non-sendable type 'Point' of property 'point' cannot exit main actor-isolated context}}
159-
_ = await anno.point // expected-warning {{non-sendable type 'Point' of property 'point' cannot exit global actor 'SomeGlobalActor'-isolated context}}
160-
// expected-warning@-1 {{non-sendable type 'NoGlobalActorValueType' cannot be sent into global actor 'SomeGlobalActor'-isolated context in call to property 'point'}}
158+
_ = await ext.point // expected-warning {{non-Sendable type 'Point' of property 'point' cannot exit main actor-isolated context}}
159+
_ = await anno.point // expected-warning {{non-Sendable type 'Point' of property 'point' cannot exit global actor 'SomeGlobalActor'-isolated context}}
160+
// expected-warning@-1 {{non-Sendable type 'NoGlobalActorValueType' cannot be sent into global actor 'SomeGlobalActor'-isolated context in call to property 'point'}}
161161

162162
_ = formance.counter
163163
_ = anno.counter
164164

165165
// these will always need an await
166-
_ = await (formance as MainCounter).counter // expected-warning {{non-sendable type 'any MainCounter' cannot be sent into main actor-isolated context in call to property 'counter'}}
166+
_ = await (formance as MainCounter).counter // expected-warning {{non-Sendable type 'any MainCounter' cannot be sent into main actor-isolated context in call to property 'counter'}}
167167
_ = await ext[1]
168168
_ = await formance.ticker
169-
_ = await ext.polygon // expected-warning {{non-sendable type '[Point]' of property 'polygon' cannot exit main actor-isolated context}}
169+
_ = await ext.polygon // expected-warning {{non-Sendable type '[Point]' of property 'polygon' cannot exit main actor-isolated context}}
170170
_ = await InferredFromContext.stuff
171-
_ = await NoGlobalActorValueType.polygon // expected-warning {{non-sendable type '[Point]' of static property 'polygon' cannot exit main actor-isolated context}}
171+
_ = await NoGlobalActorValueType.polygon // expected-warning {{non-Sendable type '[Point]' of static property 'polygon' cannot exit main actor-isolated context}}
172172
}
173173

174174
// expected-warning@+2 {{memberwise initializer for 'NoGlobalActorValueType' cannot be both nonisolated and global actor 'SomeGlobalActor'-isolated; this is an error in the Swift 6 language mode}}
@@ -713,15 +713,15 @@ func checkLocalFunctions() async {
713713
local1()
714714
local2()
715715

716-
// non-sendable closures don't cause problems.
716+
// non-Sendable closures don't cause problems.
717717
acceptClosure {
718718
local1()
719719
local2()
720720
}
721721

722722
// Escaping closures can make the local function execute concurrently.
723723
acceptConcurrentClosure {
724-
local2() // expected-warning{{capture of 'local2()' with non-sendable type '() -> ()' in a '@Sendable' closure}}
724+
local2() // expected-warning{{capture of 'local2()' with non-Sendable type '() -> ()' in a '@Sendable' closure}}
725725
// expected-note@-1{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
726726
}
727727

@@ -731,7 +731,7 @@ func checkLocalFunctions() async {
731731
var k = 17
732732
func local4() {
733733
acceptConcurrentClosure {
734-
local3() // expected-warning{{capture of 'local3()' with non-sendable type '() -> ()' in a '@Sendable' closure}}
734+
local3() // expected-warning{{capture of 'local3()' with non-Sendable type '() -> ()' in a '@Sendable' closure}}
735735
// expected-note@-1{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
736736
}
737737
}
@@ -868,7 +868,7 @@ actor SomeActorWithInits {
868868
// expected-note@+1 {{mutation of this property is only permitted within the actor}}
869869
let nonSendable: SomeClass
870870

871-
// Sema should not complain about referencing non-sendable members
871+
// Sema should not complain about referencing non-Sendable members
872872
// in an actor init or deinit, as those are diagnosed later by flow-isolation.
873873
init(_ x: SomeClass) {
874874
self.nonSendable = x
@@ -1720,7 +1720,7 @@ struct ReferenceSelfDotMethods {
17201720
private func testCurry() -> (Self) -> (@MainActor () -> Void) {
17211721
let functionRef = Self.mainActorAffinedFunction
17221722
// warning goes away with InferSendableFromCaptures, see actor_isolation_swift6.swift
1723-
return functionRef // expected-warning {{converting non-sendable function value to '@MainActor @Sendable () -> Void' may introduce data races}}
1723+
return functionRef // expected-warning {{converting non-Sendable function value to '@MainActor @Sendable () -> Void' may introduce data races}}
17241724
}
17251725

17261726
@MainActor

test/Concurrency/actor_isolation_swift6.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func checkIsolationValueType(_ formance: InferredFromConformance,
6565

6666
// these do need await, regardless of reference or value type
6767
_ = await (formance as any MainCounter).counter
68-
// expected-error@-1 {{non-sendable type 'any MainCounter' cannot be sent into main actor-isolated context in call to property 'counter'}}
68+
// expected-error@-1 {{non-Sendable type 'any MainCounter' cannot be sent into main actor-isolated context in call to property 'counter'}}
6969
_ = await ext[1]
7070
_ = await formance.ticker
7171
_ = await ext.polygon

0 commit comments

Comments
 (0)