Skip to content

[5.9] Accessor macros finishing touches #67149

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

DougGregor
Copy link
Member

Improve accessor macros in several different related ways:

  • Diagnose when a macro produces an accessor that already exists (instead of failing silently)
  • Allow an accessor macro that normally converts a stored property into a computed one to do nothing when applied to a computed property
  • Remove didSet/willSet when an accessor macro converts a stored property into a computed one; the macro itself takes responsibility for them.

Fixes rdar://111588129&111586568&111101833

Cherry-picked from #67148

…ready exists

We used to crash; now we diagnose and... don't crash.

Fixes rdar://111588129.
…property has one

If an accessor macro is placed on a computed property, then opts not to
produce a getter/setter, we would produce an error because the macro
didn't make the computed property... computed. Fix that; it's already
computed, and it's fine not to add accessors.

Fixes rdar://111586568.
@DougGregor DougGregor requested a review from a team as a code owner July 6, 2023 04:18
@DougGregor
Copy link
Member Author

@swift-ci please test

As with the initial value of a property that is converted from a stored
property to a computed property by an accessor macro, remove
didSet/willSet. It is the macro's responsibility to incorporate their
code or diagnose them.

Fixes rdar://111101833.
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

I missed a commit; cherry-picked, and rerunning now

@DougGregor
Copy link
Member Author

@swift-ci please test Linux

@DougGregor DougGregor merged commit 217d179 into swiftlang:release/5.9 Jul 6, 2023
@DougGregor DougGregor deleted the accessor-macros-finishing-touches-5.9 branch July 6, 2023 18:12
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.

2 participants