Closed
Description
Description
When the sending
is applied to the return type in a subscript and SIL is emitted, the sending
disappears from the output.
Here's an example to demonstrate this behavior:
class NonSendableKlass {}
struct S {
subscript(_: sending NonSendableKlass) -> sending NonSendableKlass { NonSendableKlass() }
}
The SIL output shows:
sil_stage raw
...
struct S {
subscript(_: sending NonSendableKlass) -> NonSendableKlass { get }
init()
}
...
// S.subscript.getter
// Isolation: unspecified
sil hidden [ossa] @$s4main1SVyAA16NonSendableKlassCAEncig : $@convention(method) (@sil_sending @owned NonSendableKlass, S) -> @owned NonSendableKlass {
Note that while the parameter retains its sending
in the SIL output, the return type's sending
is missing.
Reproduction
class NonSendableKlass {}
struct S {
subscript(_: sending NonSendableKlass) -> sending NonSendableKlass { NonSendableKlass() }
}
Expected behavior
sending
and @sil_sending
are outputted.
Environment
swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0
Additional information
No response