Skip to content

Commit 09432a9

Browse files
committed
[Concurrency] Sendable diagnostics are errors in Swift 6.
1 parent 70d02d0 commit 09432a9

File tree

3 files changed

+40
-42
lines changed

3 files changed

+40
-42
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5565,43 +5565,43 @@ ERROR(isolation_macro_experimental,none,
55655565
NOTE(in_derived_conformance, none,
55665566
"in derived conformance to %0",
55675567
(Type))
5568-
WARNING(non_sendable_param_type,none,
5569-
"non-sendable type %0 %select{passed in call to %3 %kind2|"
5570-
"exiting %3 context in call to non-isolated %kind2|"
5571-
"passed in implicitly asynchronous call to %3 %kind2|"
5572-
"in parameter of the protocol requirement satisfied by %3 %kind2|"
5573-
"in parameter of superclass method overridden by %3 %kind2|"
5574-
"in parameter of %3 '@objc' %kind2}1 cannot cross actor boundary",
5575-
(Type, unsigned, const ValueDecl *, ActorIsolation))
5576-
WARNING(non_sendable_call_argument,none,
5577-
"passing argument of non-sendable type %0 %select{into %2 context|"
5578-
"outside of %2 context}1 may introduce data races",
5579-
(Type, bool, ActorIsolation))
5580-
WARNING(non_sendable_result_type,none,
5581-
"non-sendable type %0 returned by %select{call to %3 %kind2|"
5582-
"call from %4 context to non-isolated %kind2|"
5583-
"implicitly asynchronous call to %3 %kind2|"
5584-
"%3 %kind2 satisfying protocol requirement|"
5585-
"%3 overriding %kind2|"
5586-
"%3 '@objc' %kind2}1 cannot cross actor boundary",
5587-
(Type, unsigned, const ValueDecl *, ActorIsolation))
5588-
WARNING(non_sendable_call_result_type,none,
5589-
"non-sendable type %0 returned by %select{implicitly asynchronous |}1"
5590-
"call to %2 function cannot cross actor boundary",
5591-
(Type, bool, ActorIsolation))
5592-
WARNING(non_sendable_property_type,none,
5593-
"non-sendable type %0 in %select{"
5594-
"%select{asynchronous access to %4 %kind1|"
5595-
"asynchronous access from %4 context to non-isolated %kind1|"
5596-
"implicitly asynchronous access to %4 %kind1|"
5597-
"conformance of %4 %kind1 to protocol requirement|"
5598-
"%4 overriding %kind1|"
5599-
"%4 '@objc' %kind1}3|captured local %1}2 cannot "
5600-
"cross %select{actor|task}2 boundary",
5601-
(Type, const ValueDecl *, bool, unsigned, ActorIsolation))
5602-
WARNING(non_sendable_keypath_capture,none,
5603-
"cannot form key path that captures non-sendable type %0",
5604-
(Type))
5568+
ERROR(non_sendable_param_type,none,
5569+
"non-sendable type %0 %select{passed in call to %3 %kind2|"
5570+
"exiting %3 context in call to non-isolated %kind2|"
5571+
"passed in implicitly asynchronous call to %3 %kind2|"
5572+
"in parameter of the protocol requirement satisfied by %3 %kind2|"
5573+
"in parameter of superclass method overridden by %3 %kind2|"
5574+
"in parameter of %3 '@objc' %kind2}1 cannot cross actor boundary",
5575+
(Type, unsigned, const ValueDecl *, ActorIsolation))
5576+
ERROR(non_sendable_call_argument,none,
5577+
"passing argument of non-sendable type %0 %select{into %2 context|"
5578+
"outside of %2 context}1 may introduce data races",
5579+
(Type, bool, ActorIsolation))
5580+
ERROR(non_sendable_result_type,none,
5581+
"non-sendable type %0 returned by %select{call to %3 %kind2|"
5582+
"call from %4 context to non-isolated %kind2|"
5583+
"implicitly asynchronous call to %3 %kind2|"
5584+
"%3 %kind2 satisfying protocol requirement|"
5585+
"%3 overriding %kind2|"
5586+
"%3 '@objc' %kind2}1 cannot cross actor boundary",
5587+
(Type, unsigned, const ValueDecl *, ActorIsolation))
5588+
ERROR(non_sendable_call_result_type,none,
5589+
"non-sendable type %0 returned by %select{implicitly asynchronous |}1"
5590+
"call to %2 function cannot cross actor boundary",
5591+
(Type, bool, ActorIsolation))
5592+
ERROR(non_sendable_property_type,none,
5593+
"non-sendable type %0 in %select{"
5594+
"%select{asynchronous access to %4 %kind1|"
5595+
"asynchronous access from %4 context to non-isolated %kind1|"
5596+
"implicitly asynchronous access to %4 %kind1|"
5597+
"conformance of %4 %kind1 to protocol requirement|"
5598+
"%4 overriding %kind1|"
5599+
"%4 '@objc' %kind1}3|captured local %1}2 cannot "
5600+
"cross %select{actor|task}2 boundary",
5601+
(Type, const ValueDecl *, bool, unsigned, ActorIsolation))
5602+
ERROR(non_sendable_keypath_capture,none,
5603+
"cannot form key path that captures non-sendable type %0",
5604+
(Type))
56055605
ERROR(non_concurrent_type_member,none,
56065606
"%select{stored property %2|associated value %2}1 of "
56075607
"'Sendable'-conforming %kind3 has non-sendable type %0",

test/Concurrency/actor_isolation_swift6.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -swift-version 6 -emit-sil -o /dev/null -verify %s
2-
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -swift-version 6 -emit-sil -o /dev/null -verify -enable-experimental-feature RegionBasedIsolation %s
1+
// RUN: %target-swift-frontend -disable-availability-checking -swift-version 6 -emit-sil -o /dev/null -verify %s
32

43
// REQUIRES: concurrency
54
// REQUIRES: asserts
@@ -62,7 +61,7 @@ func checkIsolationValueType(_ formance: InferredFromConformance,
6261

6362
// these do need await, regardless of reference or value type
6463
_ = await (formance as any MainCounter).counter
65-
// expected-warning@-1 {{non-sendable type 'any MainCounter' passed in implicitly asynchronous call to main actor-isolated property 'counter' cannot cross actor boundary}}
64+
// expected-error@-1 {{non-sendable type 'any MainCounter' passed in implicitly asynchronous call to main actor-isolated property 'counter' cannot cross actor boundary}}
6665
_ = await ext[1]
6766
_ = await formance.ticker
6867
_ = await ext.polygon

test/Concurrency/global_actor_serialized.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// RUN: %target-swift-frontend -emit-module -swift-version 5 -emit-module-path %t/SerializedStruct.swiftmodule -module-name SerializedStruct %S/Inputs/SerializedStruct.swift
33

44
// RUN: %target-swift-frontend %s -emit-sil -o /dev/null -verify -disable-availability-checking -swift-version 6 -I %t
5-
// RUN: %target-swift-frontend %s -emit-sil -o /dev/null -verify -disable-availability-checking -swift-version 6 -I %t -enable-experimental-feature RegionBasedIsolation
65

76
// REQUIRES: concurrency
87
// REQUIRES: asserts
@@ -16,5 +15,5 @@ import SerializedStruct // expected-warning {{add '@preconcurrency' to treat 'Se
1615
// use it to force the right checks happen.
1716
func test() async -> Int {
1817
let x = MySerializedStruct()
19-
return await x.counter // expected-warning {{non-sendable type 'MySerializedStruct' passed in implicitly asynchronous call to main actor-isolated property 'counter' cannot cross actor boundary}}
18+
return await x.counter // expected-error {{non-sendable type 'MySerializedStruct' passed in implicitly asynchronous call to main actor-isolated property 'counter' cannot cross actor boundary}}
2019
}

0 commit comments

Comments
 (0)