Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sending to subscript sending result #79560

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stzn
Copy link
Contributor

@stzn stzn commented Feb 23, 2025

Resolves #79559

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(the result of emit-silgen) shows :

sil_stage raw
...
struct S {
  subscript(_: sending NonSendableKlass) -> NonSendableKlass { get } // no sending for the return value
  init()
}

...

sil hidden [ossa] @$s4main1SVyAA16NonSendableKlassCAEncig : $@convention(method) (@sil_sending @owned NonSendableKlass, S) -> @owned NonSendableKlass { // no @sil_sending for the return value

Note that while the parameter retains its sending in the SIL output, the return type's sending is missing.

@stzn stzn changed the title Add sending to subscript getter sending result Add sending to subscript sending result Feb 23, 2025
@stzn stzn marked this pull request as ready for review February 23, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing sending for subscript sending result
1 participant