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

[K/N][CInterop] Add a contract to useContents #5300

Closed
wants to merge 1 commit into from

Conversation

isuckatcs
Copy link
Contributor

@isuckatcs isuckatcs commented May 13, 2024

^KT-66169 Fixed

@isuckatcs isuckatcs changed the title [Native, CInterop] Add contract to useContents [Native, CInterop] Add a contract to useContents May 13, 2024
@isuckatcs isuckatcs changed the title [Native, CInterop] Add a contract to useContents [K/N][CInterop] Add a contract to useContents May 20, 2024
KotlinBuild pushed a commit that referenced this pull request May 24, 2024
`kotlinx.cinterop.useContents` calls the passed block in-place and
exactly once, but it lacked the corresponding contract.

This affected certain use-cases, e.g. assigning to `val`s from the
block in order to extract values of multiple fields.

This commit fixes this by adding the
`callsInPlace(block, InvocationKind.EXACTLY_ONCE)` contract to 
`useContents`.

It also adds the same contract to `memScoped`, because `useContents`
delegates to it, and thus it is required.

^KT-66169 Fixed
@SvyatoslavScherbina
Copy link
Contributor

Thanks!
Merged manually as 68d7404.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants