mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
34781d85ed
A non-Sendable value projected directly out of a Sendable access base
(e.g. reading the non-Sendable field of an @unchecked Sendable struct
stored on an actor) was unconditionally inheriting the actor-instance
isolation of the underlying access base in
RegionAnalysisValueMap::getTrackableValueHelper. Because the value is
reached *through* a Sendable value, it should remain disconnected, not
actor-isolated.
Concretely, given:
class Obj: Equatable { static func ==(lhs: Obj, rhs: Obj) -> Bool { true } }
struct W: @unchecked Sendable { let v: Obj }
actor A { let w = W(v: Obj()) }
extension A: Equatable {
static func ==(lhs: A, rhs: A) -> Bool { lhs.w.v == rhs.w.v }
}
the projected addresses 'lhs.w.v' and 'rhs.w.v' were inferred as
'lhs'-isolated and 'rhs'-isolated, and merging them at the Obj.== apply
produced a spurious cross-isolation region-merge warning on valid code.