Skip to content

Commit 74c1a4a

Browse files
Merge pull request #5491 from swiftwasm/main
[pull] swiftwasm from main
2 parents c17f753 + 386c180 commit 74c1a4a

File tree

5 files changed

+48
-191
lines changed

5 files changed

+48
-191
lines changed

docs/proposals/RuntimeValueWitness.rst

Lines changed: 0 additions & 190 deletions
This file was deleted.

test/Macros/Inputs/syntax_macro_definitions.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,3 +1505,29 @@ public struct SingleMemberMacro: MemberMacro {
15051505
]
15061506
}
15071507
}
1508+
1509+
public struct UseIdentifierMacro: DeclarationMacro {
1510+
public static func expansion(
1511+
of node: some FreestandingMacroExpansionSyntax,
1512+
in context: some MacroExpansionContext
1513+
) throws -> [DeclSyntax] {
1514+
guard let argument = node.argumentList.first?.expression.as(StringLiteralExprSyntax.self) else {
1515+
fatalError("boom")
1516+
}
1517+
return [
1518+
"""
1519+
func \(context.makeUniqueName("name"))() {
1520+
_ = \(raw: argument.segments.first!)
1521+
}
1522+
""",
1523+
"""
1524+
struct Foo {
1525+
var \(context.makeUniqueName("name")): Int {
1526+
_ = \(raw: argument.segments.first!)
1527+
return 0
1528+
}
1529+
}
1530+
"""
1531+
]
1532+
}
1533+
}

test/Macros/macro_expand.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// RUN: %target-swift-frontend -swift-version 5 -emit-ir -load-plugin-library %t/%target-library-name(MacroDefinition) %s -module-name MacroUser -o - -g | %FileCheck --check-prefix CHECK-IR %s
2525

2626
// Execution testing
27-
// RUN: %target-build-swift -swift-version 5 -g -load-plugin-library %t/%target-library-name(MacroDefinition) %s -o %t/main -module-name MacroUser
27+
// RUN: %target-build-swift -swift-version 5 -g -load-plugin-library %t/%target-library-name(MacroDefinition) %s -o %t/main -module-name MacroUser -Xfrontend -emit-dependencies-path -Xfrontend %t/main.d -Xfrontend -emit-reference-dependencies-path -Xfrontend %t/main.swiftdeps
2828
// RUN: %target-codesign %t/main
2929
// RUN: %target-run %t/main | %FileCheck %s
3030

@@ -418,3 +418,10 @@ func testFreestandingClosureNesting() {
418418
func testLocalVarsFromDeclarationMacros() {
419419
#varValue
420420
}
421+
422+
// Variadic macro
423+
@freestanding(declaration, names: arbitrary) macro emptyDecl(_: String...) = #externalMacro(module: "MacroDefinition", type: "EmptyDeclarationMacro")
424+
425+
struct TakesVariadic {
426+
#emptyDecl("foo", "bar")
427+
}

test/Macros/macro_expand_primary.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,13 @@ final class Dog: Observable {
8585
func test() {
8686
observeDog()
8787
}
88+
89+
90+
@freestanding(declaration, names: named(Foo)) macro useIdentifier(_ value: String) = #externalMacro(module: "MacroDefinition", type: "UseIdentifierMacro")
91+
92+
#if false
93+
#useIdentifier("totallyNotDefined")
94+
#else
95+
let hello = "Hello"
96+
#useIdentifier("hello")
97+
#endif

utils/build-presets.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,10 @@ installable-package=%(installable_package)s
883883
# in Linux CI bots
884884
relocate-xdg-cache-home-under-build-subdir
885885

886+
# Temporarily disable early swift driver/syntax builds so that linux images
887+
# can use the swift release images as a base.
888+
skip-early-swift-driver
889+
skip-early-swiftsyntax
886890

887891
[preset: buildbot_linux_base]
888892
mixin-preset=

0 commit comments

Comments
 (0)