Skip to content

[Macros] Support code item macro expansion #1442

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
Mar 28, 2023
Merged

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented Mar 24, 2023

No description provided.

@rxwei rxwei changed the title Support code item macro expansion [Macros] Support code item macro expansion Mar 24, 2023
@@ -85,12 +85,13 @@ internal enum PluginToHostMessage: Codable {

enum MacroRole: String, Codable {
case expression
case freeStandingDeclaration
case declaration
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm renaming this because macro roles typically don't include "freestanding" vs "attached". Does this need a corresponding change on the compiler side? If so I can revert this. @rintaro

Copy link
Member

Choose a reason for hiding this comment

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

It does not need a corresponding change because I believe freeStandingDeclaration and expression aren't actually used in expandFreestandingMacro message. But yes, we should sync this file with swift repo one.
But you/we can do it later (after you merge this PR)

@rxwei
Copy link
Contributor Author

rxwei commented Mar 24, 2023

@swift-ci please test

@rxwei
Copy link
Contributor Author

rxwei commented Mar 25, 2023

Huh, how's this possible. It runs fine locally

/Users/ec2-user/jenkins/workspace/swift-syntax-PR-macOS/branch-main/swift-syntax/Tests/SwiftSyntaxMacrosTest/MacroSystemTests.swift:1024:5: error: cannot find 'AssertMacroExpansion' in scope
    AssertMacroExpansion(
    ^~~~~~~~~~~~~~~~~~~~
error: fatalError

@rxwei
Copy link
Contributor Author

rxwei commented Mar 25, 2023

@swift-ci please test

@rxwei rxwei force-pushed the code-item-macro branch from f92ff9b to 3cbcce5 Compare March 25, 2023 05:30
@rxwei
Copy link
Contributor Author

rxwei commented Mar 25, 2023

@swift-ci please test

@rxwei
Copy link
Contributor Author

rxwei commented Mar 27, 2023

Test Case '-[SwiftSyntaxMacrosTest.MacroSystemTests testUnwrap]' started.
Test Case '-[SwiftSyntaxMacrosTest.MacroSystemTests testUnwrap]' passed (0.008 seconds).

Both swift test and Xcode tests pass locally. Not sure what's going on with CI here.

@rxwei
Copy link
Contributor Author

rxwei commented Mar 27, 2023

@swift-ci please clean test

This got renamed to camel case.
@rxwei
Copy link
Contributor Author

rxwei commented Mar 27, 2023

@swift-ci please test

@rxwei
Copy link
Contributor Author

rxwei commented Mar 27, 2023

@swift-ci please test

@rxwei
Copy link
Contributor Author

rxwei commented Mar 27, 2023

@swift-ci please test windows

1 similar comment
@rxwei
Copy link
Contributor Author

rxwei commented Mar 28, 2023

@swift-ci please test windows

@rxwei rxwei merged commit 94add47 into swiftlang:main Mar 28, 2023
ahoppen pushed a commit to ahoppen/swift-syntax that referenced this pull request Mar 31, 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.

3 participants