|
1 | 1 | // REQUIRES: asserts
|
2 | 2 | // REQUIRES: swift_swift_parser
|
3 |
| -// FIXME: Swift parser is not enabled on Linux CI yet. |
4 |
| -// REQUIRES: OS=macosx |
5 | 3 |
|
6 | 4 | // RUN: %empty-directory(%t)
|
7 | 5 |
|
8 |
| -// RUN: %target-swift-emit-module-interface(%t/Macros.swiftinterface) -enable-experimental-feature ExtensionMacros -module-name Macros %s |
| 6 | +// RUN: %host-build-swift -swift-version 5 -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %S/../Macros/Inputs/syntax_macro_definitions.swift -no-toolchain-stdlib-rpath -swift-version 5 |
| 7 | + |
| 8 | +// RUN: %target-swift-emit-module-interface(%t/Macros.swiftinterface) -enable-experimental-feature ExtensionMacros -module-name Macros %s -load-plugin-library %t/%target-library-name(MacroDefinition) |
9 | 9 | // RUN: %FileCheck %s < %t/Macros.swiftinterface --check-prefix CHECK
|
10 | 10 | // RUN: %target-swift-frontend -compile-module-from-interface %t/Macros.swiftinterface -o %t/Macros.swiftmodule
|
11 | 11 |
|
12 | 12 | // CHECK: #if compiler(>=5.3) && $Macros && $FreestandingExpressionMacros
|
13 |
| -// CHECK-NEXT: @freestanding(expression) public macro publicStringify<T>(_ value: T) -> (T, Swift.String) = #externalMacro(module: "SomeModule", type: "StringifyMacro") |
| 13 | +// CHECK-NEXT: @freestanding(expression) public macro publicStringify<T>(_ value: T) -> (T, Swift.String) = #externalMacro(module: "MacroDefinition", type: "StringifyMacro") |
14 | 14 | // CHECK-NEXT: #endif
|
15 |
| -@freestanding(expression) public macro publicStringify<T>(_ value: T) -> (T, String) = #externalMacro(module: "SomeModule", type: "StringifyMacro") |
| 15 | +@freestanding(expression) public macro publicStringify<T>(_ value: T) -> (T, String) = #externalMacro(module: "MacroDefinition", type: "StringifyMacro") |
16 | 16 |
|
17 | 17 | // CHECK: #if compiler(>=5.3) && $Macros && $FreestandingExpressionMacros
|
18 |
| -// CHECK: @freestanding(expression) public macro labeledStringify<T>(_ value: T, label: Swift.String) -> (T, Swift.String) = #externalMacro(module: "SomeModule", type: "StringifyMacro") |
| 18 | +// CHECK: @freestanding(expression) public macro labeledStringify<T>(_ value: T, label: Swift.String) -> (T, Swift.String) = #externalMacro(module: "MacroDefinition", type: "StringifyMacro") |
19 | 19 | // CHECK-NEXT: #endif
|
20 |
| -@freestanding(expression) public macro labeledStringify<T>(_ value: T, label: String) -> (T, String) = #externalMacro(module: "SomeModule", type: "StringifyMacro") |
| 20 | +@freestanding(expression) public macro labeledStringify<T>(_ value: T, label: String) -> (T, String) = #externalMacro(module: "MacroDefinition", type: "StringifyMacro") |
21 | 21 |
|
22 | 22 | // CHECK: #if compiler(>=5.3) && $Macros && $FreestandingExpressionMacros
|
23 | 23 | // CHECK: @freestanding(expression) public macro unlabeledStringify<T>(_ value: T, label: Swift.String) -> (T, Swift.String) = #labeledStringify(value, label: "default label")
|
24 | 24 | // CHECK-NEXT: #endif
|
25 | 25 | @freestanding(expression) public macro unlabeledStringify<T>(_ value: T, label: String) -> (T, String) = #labeledStringify(value, label: "default label")
|
26 | 26 |
|
27 | 27 | // CHECK: #if compiler(>=5.3) && $Macros && $FreestandingExpressionMacros
|
28 |
| -// CHECK: @freestanding(expression) public macro publicLine<T>() -> T = #externalMacro(module: "SomeModule", type: "Line") where T : Swift.ExpressibleByIntegerLiteral |
| 28 | +// CHECK: @freestanding(expression) public macro publicLine<T>() -> T = #externalMacro(module: "MacroDefinition", type: "Line") where T : Swift.ExpressibleByIntegerLiteral |
29 | 29 | // CHECK-NEXT: #endif
|
30 |
| -@freestanding(expression) public macro publicLine<T: ExpressibleByIntegerLiteral>() -> T = #externalMacro(module: "SomeModule", type: "Line") |
| 30 | +@freestanding(expression) public macro publicLine<T: ExpressibleByIntegerLiteral>() -> T = #externalMacro(module: "MacroDefinition", type: "Line") |
31 | 31 |
|
32 | 32 | // CHECK: #if compiler(>=5.3) && $Macros
|
33 |
| -// CHECK: @attached(accessor) public macro myWrapper() = #externalMacro(module: "SomeModule", type: "Wrapper") |
| 33 | +// CHECK: @attached(accessor) public macro myWrapper() = #externalMacro(module: "MacroDefinition", type: "Wrapper") |
34 | 34 | // CHECK-NEXT: #endif
|
35 |
| -@attached(accessor) public macro myWrapper() = #externalMacro(module: "SomeModule", type: "Wrapper") |
| 35 | +@attached(accessor) public macro myWrapper() = #externalMacro(module: "MacroDefinition", type: "Wrapper") |
36 | 36 |
|
37 | 37 | // CHECK: #if compiler(>=5.3) && $Macros && $AttachedMacros
|
38 |
| -// CHECK: @attached(member, names: named(init), prefixed(`$`)) public macro MemberwiseInit() = #externalMacro(module: "SomeModule", type: "MemberwiseInitMacro") |
| 38 | +// CHECK: @attached(member, names: named(init), prefixed(`$`)) public macro MemberwiseInit() = #externalMacro(module: "MacroDefinition", type: "MemberwiseInitMacro") |
39 | 39 | // CHECK-NEXT: #endif
|
40 |
| -@attached(member, names: named(init), prefixed(`$`)) public macro MemberwiseInit() = #externalMacro(module: "SomeModule", type: "MemberwiseInitMacro") |
| 40 | +@attached(member, names: named(init), prefixed(`$`)) public macro MemberwiseInit() = #externalMacro(module: "MacroDefinition", type: "MemberwiseInitMacro") |
41 | 41 |
|
42 | 42 | // CHECK: #if compiler(>=5.3) && $Macros && $AttachedMacros
|
43 |
| -// CHECK: @attached(member, names: named(`init`), prefixed(`$`)) public macro MemberwiseInitFunc() = #externalMacro(module: "SomeModule", type: "MemberwiseInitFuncMacro") |
| 43 | +// CHECK: @attached(member, names: named(`init`), prefixed(`$`)) public macro MemberwiseInitFunc() = #externalMacro(module: "MacroDefinition", type: "MemberwiseInitFuncMacro") |
44 | 44 | // CHECK-NEXT: #endif
|
45 |
| -@attached(member, names: named(`init`), prefixed(`$`)) public macro MemberwiseInitFunc() = #externalMacro(module: "SomeModule", type: "MemberwiseInitFuncMacro") |
| 45 | +@attached(member, names: named(`init`), prefixed(`$`)) public macro MemberwiseInitFunc() = #externalMacro(module: "MacroDefinition", type: "MemberwiseInitFuncMacro") |
46 | 46 |
|
47 | 47 | // CHECK: #if compiler(>=5.3) && $Macros && $AttachedMacros
|
48 |
| -// CHECK: @attached(accessor, names: named(init)) public macro AccessorInitFunc() = #externalMacro(module: "SomeModule", type: "AccessorInitFuncMacro") |
| 48 | +// CHECK: @attached(accessor, names: named(init)) public macro AccessorInitFunc() = #externalMacro(module: "MacroDefinition", type: "AccessorInitFuncMacro") |
49 | 49 | // CHECK-NEXT: #endif
|
50 |
| -@attached(accessor, names: named(init)) public macro AccessorInitFunc() = #externalMacro(module: "SomeModule", type: "AccessorInitFuncMacro") |
| 50 | +@attached(accessor, names: named(init)) public macro AccessorInitFunc() = #externalMacro(module: "MacroDefinition", type: "AccessorInitFuncMacro") |
51 | 51 |
|
52 | 52 | // CHECK: #if compiler(>=5.3) && $Macros && $AttachedMacros
|
53 |
| -// CHECK: @attached(extension, conformances: Swift.Sendable) @attached(member) public macro AddSendable() = #externalMacro(module: "SomeModule", type: "SendableExtensionMacro") |
| 53 | +// CHECK: @attached(extension, conformances: Swift.Sendable) @attached(member) public macro AddSendable() = #externalMacro(module: "MacroDefinition", type: "SendableExtensionMacro") |
54 | 54 | // CHECK-NEXT: #else
|
55 |
| -// CHECK: @attached(member) public macro AddSendable() = #externalMacro(module: "SomeModule", type: "SendableExtensionMacro") |
| 55 | +// CHECK: @attached(member) public macro AddSendable() = #externalMacro(module: "MacroDefinition", type: "SendableExtensionMacro") |
56 | 56 | // CHECK-NEXT: #endif
|
57 |
| -@attached(extension, conformances: Sendable) @attached(member) public macro AddSendable() = #externalMacro(module: "SomeModule", type: "SendableExtensionMacro") |
| 57 | +@attached(extension, conformances: Sendable) @attached(member) public macro AddSendable() = #externalMacro(module: "MacroDefinition", type: "SendableExtensionMacro") |
58 | 58 |
|
59 | 59 | // CHECK-NOT: internalStringify
|
60 |
| -@freestanding(expression) macro internalStringify<T>(_ value: T) -> (T, String) = #externalMacro(module: "SomeModule", type: "StringifyMacro") |
| 60 | +@freestanding(expression) macro internalStringify<T>(_ value: T) -> (T, String) = #externalMacro(module: "MacroDefinition", type: "StringifyMacro") |
| 61 | + |
| 62 | +@freestanding(declaration, names: named(StructWithUnqualifiedLookup)) |
| 63 | +macro structWithUnqualifiedLookup() = #externalMacro(module: "MacroDefinition", type: "DefineStructWithUnqualifiedLookupMacro") |
| 64 | + |
| 65 | +let world = 17 |
| 66 | + |
| 67 | +// CHECK-NOT: structWithUnqualifiedLookup |
| 68 | +public |
| 69 | +#structWithUnqualifiedLookup |
| 70 | + |
| 71 | +// CHECK: struct StructWithUnqualifiedLookup |
0 commit comments