Skip to content

Commit 4b09d4c

Browse files
committed
[Macros] Add back the ExtensionMacro feature identifier as a language feature
that can be used in swiftinterfaces.
1 parent 53da675 commit 4b09d4c

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
SUPPRESSIBLE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexicalLifetimes annotations", 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)