swiftlang / swift

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

Opaque return type sendability checking hole #72926

Closed orobio closed 5 months ago

orobio commented 7 months ago

Description

For a Sendable opaque return type, the compiler allows the actual type to be non-Sendable.

Reproduction

extension AsyncSequence {
    func makeSendable() -> some (AsyncSequence<Element, Failure> & Sendable) {
        self
    }
}

Expected behavior

Depending on checking level, an error or warning should be emitted indicating that Self is not Sendable.

Environment

nightly-6.0-jammy: swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-06-a

Swift version 6.0-dev (LLVM c7c963afc327ad1, Swift bca5018bca30ddf)

Tested with both -strict-concurrency=complete and -swift-version 6.

Additional information

No response

hborla commented 5 months ago

This is fixed in https://github.com/apple/swift/pull/73697