Skip to content

[SILGen] Support thunking/reabstraction of @called(once) values - #91390

Open
xedin wants to merge 4 commits into
swiftlang:mainfrom
xedin:called_once+thunks
Open

[SILGen] Support thunking/reabstraction of @called(once) values#91390
xedin wants to merge 4 commits into
swiftlang:mainfrom
xedin:called_once+thunks

Conversation

@xedin

@xedin xedin commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

This change fixes thunking of conversions to @called(once) values and reabstraction
between @called(once) values. It makes sure that the parameter that takes @called(once)
is always Direct_Owned, the thunk itself never inherits @called(once) bit (the constraint is
expressed on the partial_apply that forms the value) and fixes a problem with l-value projection
when the access is consuming.

xedin added 4 commits August 10, 2026 13:06
… `@called(once)`

The thunk itself cannot be `@called(once)` just like a closure cannot
be since the constraint is about the value and is expressed on
`partial_apply` instruction that forms the value of the thunk.
These values have consuming semantics and this change makes
the behavior consistent for thunks that convert between two
`@called(once)` functions as well.
This change added a missing check to `LogicalPathComponent::project`
that doesn't handle consuming access correctly and instead assumes
that it's always Write or ReadWrite and attempt produce a writeback
`set` on a consumed value.

Also make sure that `ValueComponent::project` treats `@called(once)`
values as "assignable and consumable".
@xedin

xedin commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

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.

1 participant