Skip to content

[Observation] Forward availability and defines to extensions #67412

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 3 commits into from
Jul 26, 2023

Conversation

phausler
Copy link
Contributor

Using availability markers and #if guards for observable types incorrectly emit extensions that are inherently incompatible with extensions.

This forwards the relevant availability to the extensions.

Resolves:
rdar://112413879

}

extension DeclGroupSyntax {
var availability: AttributeListSyntax? {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DougGregor this seems really complex to forward things - should this be included in SwiftSyntax/macros directly?

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps. We'd need to clarify what exactly should be automatically transferred to the extensions and implement that in SwiftSyntax.

@phausler
Copy link
Contributor Author

@swift-ci please test

@phausler phausler force-pushed the pr/observation_availability branch from b42a3aa to cc1b386 Compare July 20, 2023 23:58
@phausler
Copy link
Contributor Author

@swift-ci please test

@phausler
Copy link
Contributor Author

@swift-ci please test

@phausler
Copy link
Contributor Author

Windows failure seems unrelated.

@phausler
Copy link
Contributor Author

@swift-ci please test windows

}

extension DeclGroupSyntax {
var availability: AttributeListSyntax? {
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps. We'd need to clarify what exactly should be automatically transferred to the extensions and implement that in SwiftSyntax.

@phausler phausler merged commit 0fca519 into swiftlang:main Jul 26, 2023
phausler added a commit to phausler/swift that referenced this pull request Jul 26, 2023
…ng#67412)

* [Observation] Forward availability and defines to extensions

* Simplify availability slightly from review feedback

* Simplify availability for extensions to use `.with`
phausler added a commit that referenced this pull request Jul 30, 2023
* [Observation] Forward availability and defines to extensions (#67412)

* [Observation] Forward availability and defines to extensions

* Simplify availability slightly from review feedback

* Simplify availability for extensions to use `.with`

* Use older name for detaching nodes

* Force a newline for the trailing trivia of the replicated availability
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