Skip to content

[cxx-interop] Allow specific getters/setters to be imported as comput… #65010

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

Merged
merged 1 commit into from
Apr 7, 2023

Conversation

zoecarver
Copy link
Contributor

…ed properties.

Adds SWIFT_COMPUTED_PROPERTY. Refs -cxx-interop-getters-setters-as-properties.

@zoecarver zoecarver requested review from hyp and egorzhdan as code owners April 7, 2023 17:25
@zoecarver
Copy link
Contributor Author

rdar://107757246

…ed properties.

Adds `SWIFT_COMPUTED_PROPERTY`. Refs `-cxx-interop-getters-setters-as-properties`.
@zoecarver zoecarver force-pushed the computed-properties-macro branch from 6d4a5fb to 5a20d72 Compare April 7, 2023 17:30
@zoecarver
Copy link
Contributor Author

@swift-ci please test

__attribute__((swift_attr("import_computed_property")))

struct Record {
int getX() SWIFT_COMPUTED_PROPERTY { return 42; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you test this also applying to both getter and setter?

@ravikandhadai
Copy link
Contributor

@zoecarver wondering how will the errors look if the attribute is used on a method with arguments? A test for that? Also, wondering if there can be name collisions when importing the two different methods using this attributes. If so, how the errors would look?

@zoecarver zoecarver merged commit 4cbd4a1 into swiftlang:main Apr 7, 2023
@zoecarver
Copy link
Contributor Author

We can add further testing after the fact on main.

@zoecarver
Copy link
Contributor Author

Want to get this into 5.9 asap

Copy link
Contributor

@ravikandhadai ravikandhadai left a comment

Choose a reason for hiding this comment

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

LGTM

@ravikandhadai
Copy link
Contributor

@zoecarver wondering how will the errors look if the attribute is used on a method with arguments? A test for that? Also, wondering if there can be name collisions when importing the two different methods using this attributes. If so, how the errors would look?

IIUC if the attribute is wrongly used, it wouldn't have any effect.

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.

3 participants