Skip to content
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

[Distributed] Carry SPI attribute to stub types #79987

Merged
merged 2 commits into from
Mar 18, 2025

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Mar 13, 2025

The distributed macro must carry forward the @_spi attribute

resolves rdar://146940405

I need to cleanup how we detect the attr;

@ktoso
Copy link
Contributor Author

ktoso commented Mar 13, 2025

@swift-ci please smoke test

@ktoso ktoso force-pushed the wip-copy-spi-da branch from b991514 to a27632a Compare March 13, 2025 13:01
@@ -133,6 +137,9 @@ extension DistributedResolvableMacro {
var isGenericOverActorSystem = false
var specificActorSystemRequirement: TypeSyntax?

let attributes = proto.attributes.filter { attr in
attr.as(AttributeSyntax.self)?.attributeName.trimmed.description == "_spi"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ahoppen would you mind helping me out what a better way to spell this is?

Copy link
Member

Choose a reason for hiding this comment

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

I would suggest

    let attributes = proto.attributes.filter {
      $0.as(AttributeSyntax.self)?.attributeName.as(IdentifierTypeSyntax.self)?.name == .identifier("_spi")
    }

Also, you should be able to just do "(attributes)" below and shouldn’t need raw: or description or joined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, that's nicer! Weirdly enough the == .identifier() does not compare as true, but I could do .text == "spi" to work around that.

Also removed the raw: below, thanks!

@ktoso ktoso force-pushed the wip-copy-spi-da branch from a27632a to da0642b Compare March 18, 2025 06:40
@ktoso ktoso force-pushed the wip-copy-spi-da branch from da0642b to b081582 Compare March 18, 2025 06:41
@ktoso ktoso enabled auto-merge (squash) March 18, 2025 06:42
@ktoso
Copy link
Contributor Author

ktoso commented Mar 18, 2025

@swift-ci please smoke test

@ktoso ktoso merged commit 39687f1 into swiftlang:main Mar 18, 2025
3 checks passed
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