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

Add an article that describes how macros should be versioned when updating their swift-syntax dependency #2024

Merged
merged 1 commit into from
Aug 9, 2023

Conversation

ahoppen
Copy link
Contributor

@ahoppen ahoppen commented Aug 8, 2023

No description provided.

@ahoppen ahoppen requested a review from bnbarham August 8, 2023 00:10
@ahoppen ahoppen force-pushed the ahoppen/macro-versioning branch 2 times, most recently from 0843072 to 9263dee Compare August 8, 2023 01:57

## Representation of New Syntax with Old swift-syntax Versions

In case that a swift-syntax verison is used that is older than the compiler’s version, then swift-syntax will not be able to represent the new syntactic structures (like new statements) in the source file because it doesn’t know about them.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In case that a swift-syntax verison is used that is older than the compiler’s version, then swift-syntax will not be able to represent the new syntactic structures (like new statements) in the source file because it doesn’t know about them.
If a swift-syntax verison is used that is older than the compiler’s version, then swift-syntax will not be able to represent the new syntactic structures (like new statements) in the source file because it doesn’t know about them.

@@ -0,0 +1,29 @@
# Updating a Macro to a New Major Swift-syntax Version
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Swift-syntax here vs swift-syntax below. Personally I wouldn't title case it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Damn, I didn’t double-check the output of titlecase.com here

@ahoppen
Copy link
Contributor Author

ahoppen commented Aug 8, 2023

@swift-ci Please test


For simplicity, this article assumes that `509` is the current swift-syntax version and `510` the next, but everything applies to any other major swift-syntax version update, including version jumps to `600`.

When staring to write a macro, no special considerations need to be made with regard in terms of versioning. Depending on swift-syntax as with `from: "509.0.0"` will make sure that the macro receives any bug fix updates to swift-syntax 509. For example, a macro depending on swift-syntax 509 might be released as version 1.0, 1.2, 2.0, …
Copy link

@tevelee tevelee Aug 8, 2023

Choose a reason for hiding this comment

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

Suggested change
When staring to write a macro, no special considerations need to be made with regard in terms of versioning. Depending on swift-syntax as with `from: "509.0.0"` will make sure that the macro receives any bug fix updates to swift-syntax 509. For example, a macro depending on swift-syntax 509 might be released as version 1.0, 1.2, 2.0, …
When starting to write a macro, no special considerations need to be made with regard to versioning. Depending on swift-syntax as with `from: "509.0.0"` will make sure that the macro receives any bug fix updates to swift-syntax 509. For example, a macro depending on swift-syntax 509 might be released as version 1.0, 1.2, 2.0, …

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching these typos @tevelee

@ahoppen
Copy link
Contributor Author

ahoppen commented Aug 8, 2023

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge August 8, 2023 15:39
@ahoppen
Copy link
Contributor Author

ahoppen commented Aug 8, 2023

@swift-ci Please test Windows

@ahoppen ahoppen merged commit 819a68b into swiftlang:main Aug 9, 2023
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.

None yet

4 participants