-
Notifications
You must be signed in to change notification settings - Fork 49
[Runtime] Support recursive types #58
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
Conversation
Will move to |
@dnadoba Applied your feedback, can you take another look? |
There was a problem hiding this 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.
There was a problem hiding this 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.
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.