Store Original Macro Implementations Per SwiftSyntax Version as Separate Files#62
Store Original Macro Implementations Per SwiftSyntax Version as Separate Files#62omochi wants to merge 1 commit intogohanlon:mainfrom
Conversation
| //===----------------------------------------------------------------------===// | ||
| // swift-format-ignore-file | ||
| // The content of this file was copied from the swift-syntax repository. | ||
| // version: 602.0.0 |
There was a problem hiding this comment.
There is a discrepancy between the filename 601 and the commit version 602.0.0, but this is not a mistake.
The implementation included in 602.0.0 of the swift-syntax repository
can be compiled with Swift Syntax 601 but not with Swift Syntax 600.
Therefore, the filename is 601 to indicate that it is "available from 601",
and this corresponds to the parameter of canImport.
|
I haven't read through this properly yet, but I wanted to be sure that you'd seen the DEVELOPMENT.md file that I added recently. It mentions Given all that:
|
|
Sorry, I missed |
I tried installing podman with brew, running [omochi@omochi-mbp 2-swift-memberwise-init-macro (versioned-macrosample-splitfile =)]$ bin/setup-podman --status
Podman: ✓ installed (5.7.1)
Machine: ✓ running (16 GB, 9 CPUs)
Host: 32 GB RAM, 12 CPUs
[omochi@omochi-mbp 2-swift-memberwise-init-macro (versioned-macrosample-splitfile =)]$ make test-linux
./bin/test-linux --parallel --continue-on-error --log-dir ./tmp/logs
Auto-detected 2 parallel jobs (16 GB Podman VM)
Logging to: ./tmp/logs/2026-01-11_154245
Running 25 combinations with 2 parallel jobs...
./bin/test-linux: line 420: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
make: *** [test-linux] Error 2My machine environment is macOS Tahoe 26.1. By the way, I was manually testing 5 different environments like this on my end.
I wasn't used to such a conventional file name, so I overlooked it. For example, in the SwiftSyntax repository, it says:
When opening the link, it describes how to build and test, and we can naturally find the relevant information. When I read It might be more approachable if it said something like: |
The background and purpose of this patch are the same as the previous PR,
MacroTestingTests#60, so please refer to that.
Content of this patch:
As discussed there, this implements the method of storing multiple versions of sample macros in this repository by having separate files for each version, instead of one long file divided by
#if.When maintaining multiple versions of implementations, individual files are enclosed in
#ifso that only specific sample macros can be enabled, in combination with the currently adopted SwiftSyntax version.Adding Comments
We are disabling
swift-formatso that the sample macro code can be saved as is.We are including the version of the source package to facilitate tracking when the sample macro is updated upstream.