Skip to content

Commit 3be6344

Browse files
committed
Eliminate dependencies on _SwiftSyntaxMacros having actual macros in it
1 parent 5ec4143 commit 3be6344

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

test/Index/index_macros.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// REQUIRES: OS=macosx
44

55

6-
macro myLine: Int = _SwiftSyntaxMacros.LineMacro
7-
macro myFilename<T: ExpressibleByStringLiteral>: T = _SwiftSyntaxMacros.FilePathMacro
8-
macro myStringify<T>(_: T) -> (T, String) = _SwiftSyntaxMacros.StringifyMacro
6+
macro myLine: Int = MacroDefinition.LineMacro
7+
macro myFilename<T: ExpressibleByStringLiteral>: T = MacroDefinition.FileMacro
8+
macro myStringify<T>(_: T) -> (T, String) = MacroDefinition.StringifyMacro
99

1010
func test(x: Int) {
1111
_ = #myLine

test/Macros/macros_diagnostics.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
// RUN: %target-typecheck-verify-swift -enable-experimental-feature Macros -module-name MacrosTest
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift -I %swift-host-lib-dir -L %swift-host-lib-dir -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %S/Inputs/syntax_macro_definitions.swift -g -no-toolchain-stdlib-rpath
3+
// RUN: %target-typecheck-verify-swift -enable-experimental-feature Macros -module-name MacrosTest -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir
24
// REQUIRES: OS=macosx
35

4-
macro stringify<T>(_ value: T) -> (T, String) = _SwiftSyntaxMacros.StringifyMacro
6+
macro stringify<T>(_ value: T) -> (T, String) = MacroDefinition.StringifyMacro
57
macro missingMacro1(_: Any) = MissingModule.MissingType // expected-note{{'missingMacro1' declared here}}
68
macro missingMacro2(_: Any) = MissingModule.MissingType
79

test/ModuleInterface/macros.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
// RUN: %target-swift-frontend -compile-module-from-interface %t/Macros.swiftinterface -o %t/Macros.swiftmodule
88

99
// CHECK: #if compiler(>=5.3) && $Macros
10-
// CHECK-NEXT: public macro publicStringify<T>(_ value: T) -> (T, Swift.String) = _SwiftSyntaxMacros.StringifyMacro
10+
// CHECK-NEXT: public macro publicStringify<T>(_ value: T) -> (T, Swift.String) = SomeModule.StringifyMacro
1111
// CHECK-NEXT: #endif
12-
public macro publicStringify<T>(_ value: T) -> (T, String) = _SwiftSyntaxMacros.StringifyMacro
12+
public macro publicStringify<T>(_ value: T) -> (T, String) = SomeModule.StringifyMacro
1313

1414
// CHECK: #if compiler(>=5.3) && $Macros
15-
// CHECK: public macro publicLine<T>: T = _SwiftSyntaxMacros.Line where T : Swift.ExpressibleByIntegerLiteral
15+
// CHECK: public macro publicLine<T>: T = SomeModule.Line where T : Swift.ExpressibleByIntegerLiteral
1616
// CHECK-NEXT: #endif
17-
public macro publicLine<T: ExpressibleByIntegerLiteral>: T = _SwiftSyntaxMacros.Line
17+
public macro publicLine<T: ExpressibleByIntegerLiteral>: T = SomeModule.Line
1818

1919
// CHECK-NOT: internalStringify
20-
macro internalStringify<T>(_ value: T) -> (T, String) = _SwiftSyntaxMacros.StringifyMacro
20+
macro internalStringify<T>(_ value: T) -> (T, String) = SomeModule.StringifyMacro
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
public macro publicStringify<T>(_ value: T) -> (T, String) = _SwiftSyntaxMacros.StringifyMacro
1+
public macro publicStringify<T>(_ value: T) -> (T, String) = SomeModule.StringifyMacro
22

3-
macro internalStringify<T>(_ value: T) -> (T, String) = _SwiftSyntaxMacros.StringifyMacro
3+
macro internalStringify<T>(_ value: T) -> (T, String) = SomeModule.StringifyMacro

test/Serialization/macros.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import def_macros
1010

1111
func test(a: Int, b: Int) {
1212
_ = #publicStringify(a + b)
13+
// expected-error@-1{{external macro implementation type 'SomeModule.StringifyMacro' could not be found for macro 'publicStringify'; the type must be public and provided via '-load-plugin-library'}}
1314

1415
_ = #internalStringify(a + b)
1516
// expected-error@-1{{macro 'internalStringify' is undefined}}

0 commit comments

Comments
 (0)