Skip to content

Add @_used and @_section attributes to match #65901 #1710

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

Closed
wants to merge 1 commit into from

Conversation

kubamracek
Copy link
Contributor

@kubamracek
Copy link
Contributor Author

@swift-ci please test

@kimdv
Copy link
Contributor

kimdv commented May 28, 2023

Hi @kubamracek 👋

You need to run the code generation to get attribute kinds updated with your changes.
You can read about it here: https://github.com/apple/swift-syntax/blob/main/CodeGeneration/README.md

@kubamracek
Copy link
Contributor Author

@kimdv Thanks for the info, I actually did run the regenerate step, but the SimpleDeclAttributes seem to simply have no effect (no need?) on the generated swift files?

@kubamracek
Copy link
Contributor Author

...which made me realize that @_used is supposed to be an SimpleDeclAttribute, but @_section isn't and it's supposed to have arguments, so I need to do some more work here :)

@kubamracek kubamracek force-pushed the mracek/used-and-section-attrs branch from d80ce6f to b81f557 Compare May 28, 2023 17:32
@kubamracek
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@kubamracek
Copy link
Contributor Author

@swift-ci please test

@kubamracek kubamracek requested a review from kimdv May 29, 2023 02:07
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Hey Kuba,

Thanks for updating the parser. And it indeed looks like we are no longer using DECL_ATTR_KINDS. I’m removing it a follow-up PR.

Could you add a test case for @_used and @_section, e.g. in AttributeTests.swift?

@ahoppen
Copy link
Member

ahoppen commented May 30, 2023

Also, I just noticed: If you can’t write these attributes in Swift source, there’s no need to add them to swift-syntax.

@ahoppen
Copy link
Member

ahoppen commented May 30, 2023

And I’m removing the code generation of decl modifiers and type attributes here: #1715

@DougGregor
Copy link
Member

Do we need this at all? They can be parsed as custom attributes, and it's fine, right?

@ahoppen
Copy link
Member

ahoppen commented Jun 8, 2023

Ah, true. We would need if @_used and @_section were type attributes to disambiguate @_used () -> Void but that doesn’t appear to be the case.

@kubamracek
Copy link
Contributor Author

Ha! So I don't even need the parser changes (section attr takes a string argument), and I can just close this PR?

@ahoppen
Copy link
Member

ahoppen commented Jun 9, 2023

Yes, looks like it.

@kubamracek kubamracek closed this Jun 9, 2023
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.

4 participants