Skip to content

Conversation

czechboy0
Copy link
Contributor

Motivation

Runtime changes for apple/swift-openapi-generator#70.

Modifications

Introduce a new wrapper type CopyOnWriteBox as a reference type with copy-on-write semantics, to be used by the generated code to hide a ref type inside a struct that needs boxing. (Details on the logic will be in the generator PR description.)

Result

A new type available for the generated code to use for breaking reference cycles.

Test Plan

Added unit tests for the type.

@czechboy0 czechboy0 marked this pull request as ready for review October 18, 2023 15:49
@czechboy0 czechboy0 marked this pull request as draft October 18, 2023 20:52
@czechboy0
Copy link
Contributor Author

Will move to get + _modify tomorrow, so taking the PR back to draft.

@czechboy0 czechboy0 marked this pull request as ready for review October 19, 2023 08:10
@czechboy0
Copy link
Contributor Author

@dnadoba Applied your feedback, can you take another look?

Copy link
Member

@dnadoba dnadoba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything needs to be @inlineable, including the protocol conformances.

Copy link
Member

@dnadoba dnadoba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some @inlinable are missing but otherwise it looks good.
Note that the implementations of the Custom[Debug]StringConvertible protocols could be made @inlinable as well but they are usually called through existential anyway so I'm fine without adding them.

@czechboy0 czechboy0 merged commit c48f166 into apple:main Oct 19, 2023
@czechboy0 czechboy0 deleted the hd-recursive-types branch October 19, 2023 10:27
@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants