mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
TLDR: This makes it so that we always can parse sending/transferring but changes the semantic language effects to be keyed on RegionBasedIsolation instead. ---- The key thing that makes this all work is that I changed all of the "special" semantic changes originally triggered on *ArgsAndResults to now be triggered based on RegionBasedIsolation being enabled. This makes a lot of sense since we want these semantic changes specifically to be combined with the checkers that RegionBasedIsolation turns on. As a result, even though this causes these two features to always be enabled, we just parse it but we do not use it for anything semantically. rdar://128961672
34 lines
1.1 KiB
Swift
34 lines
1.1 KiB
Swift
// RUN: %target-build-swift -swift-version 5 %s -strict-concurrency=complete -Xfrontend -verify
|
|
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: OS=macosx
|
|
|
|
class NonSendableKlass {} // expected-note 3{{class 'NonSendableKlass' does not conform to the 'Sendable' protocol}}
|
|
|
|
@available(macOS 10.15, *)
|
|
actor MyActor {
|
|
var x = NonSendableKlass()
|
|
|
|
nonisolated func doSomething() -> NonSendableKlass {
|
|
return self.assumeIsolated { isolatedSelf in // expected-warning {{type 'NonSendableKlass' does not conform to the 'Sendable' protocol}}
|
|
let x: NonSendableKlass = isolatedSelf.x
|
|
return x
|
|
}
|
|
}
|
|
|
|
nonisolated func doSomething2() -> NonSendableKlass {
|
|
let r: NonSendableKlass = assumeIsolated { isolatedSelf in // expected-warning {{type 'NonSendableKlass' does not conform to the 'Sendable' protocol}}
|
|
let x: NonSendableKlass = isolatedSelf.x
|
|
return x
|
|
}
|
|
return r
|
|
}
|
|
}
|
|
|
|
@available(macOS 10.15, *)
|
|
nonisolated func mainActorAssumeIsolated() -> NonSendableKlass {
|
|
return MainActor.assumeIsolated { // expected-warning {{type 'NonSendableKlass' does not conform to the 'Sendable' protocol}}
|
|
NonSendableKlass()
|
|
}
|
|
}
|