Skip to content

Accessor macros finishing touches #67148

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

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

…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.
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 smoke test

@DougGregor
Copy link
Member Author

@swift-ci please clean test Windows

@DougGregor DougGregor merged commit f5427ea into swiftlang:main Jul 6, 2023
@DougGregor DougGregor deleted the accessor-macros-finishing-touches branch July 6, 2023 05:56
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.

1 participant