mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Updates for 6.2.
These were changes that were not updated in the previous commit due to merge conflict resolution or that the test itself was not in 6.2.
This commit is contained in:
@@ -5960,7 +5960,7 @@ ERROR(nonisolated_lazy,none,
|
||||
())
|
||||
|
||||
ERROR(non_sendable_from_deinit,none,
|
||||
"cannot access %1 %2 with a non-sendable type %0 from nonisolated deinit",
|
||||
"cannot access %1 %2 with a non-Sendable type %0 from nonisolated deinit",
|
||||
(Type, DescriptiveDeclKind, DeclName))
|
||||
|
||||
ERROR(actor_instance_property_wrapper,none,
|
||||
|
||||
@@ -176,7 +176,7 @@ 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{{actor-isolated property 'effPropA' cannot be accessed from outside of the actor}} {{7-7=await }}
|
||||
_ = a.effPropA
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ func checkAsyncPropertyAccess() async {
|
||||
act.text[0] += "hello" // expected-error{{actor-isolated property 'text' can not be mutated from a nonisolated context}}
|
||||
// expected-note@-1{{consider declaring an isolated method on 'MyActor' to perform the mutation}}
|
||||
|
||||
_ = act.point // expected-warning{{non-sendable type 'Point' of property 'point' cannot exit actor-isolated context}}
|
||||
_ = act.point // expected-warning{{non-Sendable type 'Point' of property 'point' cannot exit actor-isolated context}}
|
||||
// expected-warning@-1 {{actor-isolated property 'point' cannot be accessed from outside of the actor}} {{7-7=await }}
|
||||
}
|
||||
|
||||
@@ -1054,8 +1054,8 @@ func testCrossModuleLets(actor: OtherModuleActor) async {
|
||||
_ = await actor.a // okay
|
||||
_ = actor.b // okay
|
||||
_ = actor.c // expected-error{{actor-isolated property 'c' cannot be accessed from outside of the actor}} {{7-7=await }}
|
||||
// expected-warning@-1{{non-sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
|
||||
_ = await actor.c // expected-warning{{non-sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
|
||||
// expected-warning@-1{{non-Sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
|
||||
_ = await actor.c // expected-warning{{non-Sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
|
||||
_ = await actor.d // okay
|
||||
}
|
||||
|
||||
@@ -1088,8 +1088,8 @@ actor CrossModuleFromInitsActor {
|
||||
_ = await actor.a // okay
|
||||
_ = actor.b // okay
|
||||
_ = actor.c // expected-error{{actor-isolated property 'c' cannot be accessed from outside of the actor}} {{9-9=await }}
|
||||
// expected-warning@-1{{non-sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
|
||||
_ = await actor.c // expected-warning{{non-sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
|
||||
// expected-warning@-1{{non-Sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
|
||||
_ = await actor.c // expected-warning{{non-Sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
|
||||
_ = await actor.d // okay
|
||||
}
|
||||
}
|
||||
@@ -1636,7 +1636,7 @@ class ReferenceActor {
|
||||
init() async {
|
||||
self.a = ProtectNonSendable()
|
||||
|
||||
// expected-warning@+2 {{non-sendable type 'NonSendable' of property 'ns' cannot exit actor-isolated context}}
|
||||
// expected-warning@+2 {{non-Sendable type 'NonSendable' of property 'ns' cannot exit actor-isolated context}}
|
||||
// expected-warning@+1 {{actor-isolated property 'ns' cannot be accessed from outside of the actor}} {{9-9=await }}
|
||||
_ = a.ns
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ extension A1 {
|
||||
_ = await self.asynchronous(nil)
|
||||
|
||||
// Across to a different actor, so Sendable restriction is enforced.
|
||||
_ = other.localLet // expected-warning{{non-sendable type 'NotConcurrent' of property 'localLet' cannot exit actor-isolated context}}
|
||||
_ = other.localLet // expected-warning{{non-Sendable type 'NotConcurrent' of property 'localLet' cannot exit actor-isolated context}}
|
||||
// expected-warning@-1 {{actor-isolated property 'localLet' cannot be accessed from outside of the actor}} {{9-9=await }}
|
||||
_ = await other.synchronous() // expected-tns-warning {{non-Sendable 'NotConcurrent?'-typed result can not be returned from actor-isolated instance method 'synchronous()' to actor-isolated context}}
|
||||
_ = await other.asynchronous(nil)
|
||||
@@ -138,13 +138,13 @@ enum E {
|
||||
|
||||
func globalTest() async {
|
||||
// expected-warning@+1 {{global actor 'SomeGlobalActor'-isolated let 'globalValue' cannot be accessed from outside of the actor}} {{11-11=await }}
|
||||
let a = globalValue // expected-warning{{non-sendable type 'NotConcurrent?' of let 'globalValue' cannot exit global actor 'SomeGlobalActor'-isolated context}}
|
||||
let a = globalValue // expected-warning{{non-Sendable type 'NotConcurrent?' of let 'globalValue' cannot exit global actor 'SomeGlobalActor'-isolated context}}
|
||||
await globalAsync(a) // expected-tns-warning {{sending 'a' risks causing data races}}
|
||||
// expected-tns-note @-1 {{sending global actor 'SomeGlobalActor'-isolated 'a' to global actor 'SomeGlobalActor'-isolated global function 'globalAsync' risks causing data races between global actor 'SomeGlobalActor'-isolated and local nonisolated uses}}
|
||||
await globalSync(a) // expected-tns-note {{access can happen concurrently}}
|
||||
|
||||
// expected-warning@+1 {{global actor 'SomeGlobalActor'-isolated static property 'notSafe' cannot be accessed from outside of the actor}} {{11-11=await }}
|
||||
let _ = E.notSafe // expected-warning{{non-sendable type 'NotConcurrent?' of static property 'notSafe' cannot exit global actor 'SomeGlobalActor'-isolated context}}
|
||||
let _ = E.notSafe // expected-warning{{non-Sendable type 'NotConcurrent?' of static property 'notSafe' cannot exit global actor 'SomeGlobalActor'-isolated context}}
|
||||
|
||||
#if ALLOW_TYPECHECKER_ERRORS
|
||||
// expected-typechecker-error@+3 {{expression is 'async' but is not marked with 'await'}}
|
||||
@@ -173,7 +173,7 @@ class ClassWithGlobalActorInits { // expected-tns-note 2{{class 'ClassWithGlobal
|
||||
@MainActor
|
||||
func globalTestMain(nc: NotConcurrent) async {
|
||||
// expected-warning@+1 {{global actor 'SomeGlobalActor'-isolated let 'globalValue' cannot be accessed from outside of the actor}} {{11-11=await }}
|
||||
let a = globalValue // expected-warning {{non-sendable type 'NotConcurrent?' of let 'globalValue' cannot exit global actor 'SomeGlobalActor'-isolated context}}
|
||||
let a = globalValue // expected-warning {{non-Sendable type 'NotConcurrent?' of let 'globalValue' cannot exit global actor 'SomeGlobalActor'-isolated context}}
|
||||
await globalAsync(a) // expected-tns-warning {{sending 'a' risks causing data races}}
|
||||
// expected-tns-note @-1 {{sending global actor 'SomeGlobalActor'-isolated 'a' to global actor 'SomeGlobalActor'-isolated global function 'globalAsync' risks causing data races between global actor 'SomeGlobalActor'-isolated and local main actor-isolated uses}}
|
||||
await globalSync(a) // expected-tns-note {{access can happen concurrently}}
|
||||
|
||||
@@ -445,7 +445,7 @@ nonisolated func callFromNonisolated(ns: NotSendable) async {
|
||||
#if ALLOW_TYPECHECKER_ERRORS
|
||||
optionalIsolatedSync(ns, to: myActor)
|
||||
// expected-typechecker-error@-1 {{actor-isolated global function 'optionalIsolatedSync(_:to:)' cannot be called from outside of the actor}} {{3-3=await }}
|
||||
// expected-complete-warning@-2 {{passing argument of non-sendable type 'NotSendable' into actor-isolated context may introduce data races}}
|
||||
// expected-complete-warning@-2 {{passing argument of non-Sendable type 'NotSendable' into actor-isolated context may introduce data races}}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ nonisolated func callFromNonisolated(ns: NotSendable) async {
|
||||
#if ALLOW_TYPECHECKER_ERRORS
|
||||
optionalIsolatedSync(ns, to: myActor)
|
||||
// expected-typechecker-error@-1 {{actor-isolated global function 'optionalIsolatedSync(_:to:)' cannot be called from outside of the actor}} {{3-3=await }}
|
||||
// expected-complete-warning@-2 {{passing argument of non-sendable type 'NotSendable' into actor-isolated context may introduce data races}}
|
||||
// expected-complete-warning@-2 {{passing argument of non-Sendable type 'NotSendable' into actor-isolated context may introduce data races}}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -460,7 +460,7 @@ struct DowngradeForPreconcurrency {
|
||||
AsyncStream<NonSendable> {
|
||||
self.x
|
||||
// expected-warning@-1 {{main actor-isolated property 'x' cannot be accessed from outside of the actor; this is an error in the Swift 6 language mode}} {{7-7=await }}
|
||||
// expected-warning@-2 {{non-sendable type 'NonSendable' of property 'x' cannot exit main actor-isolated context; this is an error in the Swift 6 language mode}}
|
||||
// expected-warning@-2 {{non-Sendable type 'NonSendable' of property 'x' cannot exit main actor-isolated context; this is an error in the Swift 6 language mode}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ func fromMainActor() async {
|
||||
func fromConcurrencyAware() async {
|
||||
let view = CoffeeTrackerView() // synthesized 'init' is 'nonisolated'
|
||||
|
||||
// expected-warning@+2 {{non-sendable type 'some View' of property 'body' cannot exit main actor-isolated context}}
|
||||
// expected-warning@+2 {{non-Sendable type 'some View' of property 'body' cannot exit main actor-isolated context}}
|
||||
// expected-warning@+1 {{main actor-isolated property 'body' cannot be accessed from outside of the actor}} {{7-7=await }}
|
||||
_ = view.body
|
||||
|
||||
|
||||
Reference in New Issue
Block a user