Skip to content

Conversation

@DougGregor
Copy link
Member

The fundamental problem here is that we don't know a priori whether an accessor macro will convert a stored property into a computed one. That can only be determined after macro expansion, which depends on having a determined type for the property.

Implicit initialization of optional-typed values (e.g., "var birthDate: Date?") adds the initializer when there is storage, triggering the cycle. Introduce a very narrow fix that assumes that properties that have an accessor macro on them do not have storage. We probably want to enforce this, so that the "does this variable have storage?" query can be made cheaper.

…lues

The fundamental problem here is that we don't know a priori whether an
accessor macro will convert a stored property into a computed one.
That can only be determined after macro expansion, which depends on
having a determined type for the property.

Implicit initialization of optional-typed values (e.g., "var
birthDate: Date?") adds the initializer when there is storage,
triggering the cycle. Introduce a very narrow fix that assumes that
properties that have an accessor macro on them do not have storage.
We probably want to enforce this, so that the "does this variable have
storage?" query can be made cheaper.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@DougGregor DougGregor merged commit a81b0b6 into swiftlang:main Feb 5, 2023
@DougGregor DougGregor deleted the accessor-macro-implicit-cycle branch February 5, 2023 03:10
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