swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.27k stars 10.33k forks source link

`weak` property in `Sendable` type leaks implementation detail #60417

Open NachoSoto opened 2 years ago

NachoSoto commented 2 years ago

Describe the bug Using weak on a Sendable class leads to a bad diagnostic.

Steps To Reproduce

final class A: NSObject, Sendable {
    lazy var a: String = "test"
}

Expected behavior

Stored property 'a' of 'Sendable'-conforming class 'A' is mutable

Actual behavior

Stored property '$__lazystorage$_a' of 'Sendable'-conforming class 'A' is mutable

Environment (please fill out the following information)

CodaFi commented 2 years ago

Tracked internally as rdar://86926732

NachoSoto commented 2 months ago

This is still happening on Swift 6.