Skip to content

Commit 3010fa5

Browse files
authored
Merge pull request #67628 from hborla/5.9-extension-macro-swiftinterface
[5.9][Macros] Add back the `ExtensionMacro` feature identifier as a `LANGUAGE_FEATURE` for use in swiftinterfaces.
2 parents 8a122ba + c6b7384 commit 3010fa5

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ LANGUAGE_FEATURE(
105105
FreestandingExpressionMacros, 382, "Expression macros",
106106
hasSwiftSwiftParser)
107107
LANGUAGE_FEATURE(AttachedMacros, 389, "Attached macros", hasSwiftSwiftParser)
108+
LANGUAGE_FEATURE(ExtensionMacros, 402, "Extension macros", hasSwiftSwiftParser)
108109
LANGUAGE_FEATURE(MoveOnly, 390, "noncopyable types", true)
109110
LANGUAGE_FEATURE(ParameterPacks, 393, "Value and type parameter packs", true)
110111
LANGUAGE_FEATURE(FreestandingMacros, 397, "freestanding declaration macros", true)

test/Macros/Inputs/ConformanceMacroLib.swiftinterface

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@
33

44
@attached(conformance)
55
public macro Equatable() = #externalMacro(module: "MacroDefinition", type: "EquatableMacro")
6+
7+
#if compiler(>=5.3) && $Macros && $AttachedMacros && $ExtensionMacros
8+
#if $ExtensionMacroAttr
9+
@attached(extension, conformances: Swift.Hashable)
10+
public macro Hashable() = #externalMacro(module: "MacroDefinition", type: "HashableMacro")
11+
#endif
12+
#endif

test/Macros/imported_conformance_macro.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ struct S {}
1616

1717
// CHECK-DUMP: extension S: Equatable {
1818
// CHECK-DUMP: }
19+
20+
@Hashable
21+
struct T {}
22+
23+
// CHECK-DUMP: extension T: Hashable {
24+
// CHECK-DUMP: }

0 commit comments

Comments
 (0)