Are macros supported on Linux yet?

From Swift.org - Download Swift, I downloaded swift-DEVELOPMENT-SNAPSHOT-2023-09-01-a-ubuntu20.04-aarch64.tar.gz , cloned swift-syntax repo, applied this patch

diff --git a/Examples/Package.swift b/Examples/Package.swift
index f10a7c4a..821d3939 100644
--- a/Examples/Package.swift
+++ b/Examples/Package.swift
@@ -62,7 +62,7 @@ let package = Package(
 // The following targets are added only if the OS is macOS. This is because Swift macros are currently
 // not available on other platforms. As a result, we're guarding these targets with `#if os(macOS)`
 // to ensure that they are only included in the package when building on a macOS system.
-#if os(macOS)
+#if os(macOS) || os(Linux)
 package.targets.append(
   contentsOf: [
     .target(

in the Examples directory run MacroExamplesPlayground

$ cd Examples
$ ~/swift-DEVELOPMENT-SNAPSHOT-2023-09-01-a-ubuntu20.04-aarch64/usr/bin/swift run MacroExamplesPlayground

and succeeded :slight_smile:

(Unfortunately 5.9 snapshots haven't got the macro patches at this moment)

8 Likes