[Macros] Add back the ExtensionMacro feature identifier as a language feature

that can be used in swiftinterfaces.
This commit is contained in:
Holly Borla
2023-07-31 13:34:27 -07:00
parent 53da6759de
commit 4b09d4c513
3 changed files with 14 additions and 0 deletions

View File

@@ -105,6 +105,7 @@ LANGUAGE_FEATURE(
FreestandingExpressionMacros, 382, "Expression macros",
hasSwiftSwiftParser)
LANGUAGE_FEATURE(AttachedMacros, 389, "Attached macros", hasSwiftSwiftParser)
LANGUAGE_FEATURE(ExtensionMacros, 402, "Extension macros", hasSwiftSwiftParser)
LANGUAGE_FEATURE(MoveOnly, 390, "noncopyable types", true)
LANGUAGE_FEATURE(ParameterPacks, 393, "Value and type parameter packs", true)
SUPPRESSIBLE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexicalLifetimes annotations", true)

View File

@@ -3,3 +3,10 @@
@attached(conformance)
public macro Equatable() = #externalMacro(module: "MacroDefinition", type: "EquatableMacro")
#if compiler(>=5.3) && $Macros && $AttachedMacros && $ExtensionMacros
#if $ExtensionMacroAttr
@attached(extension, conformances: Swift.Hashable)
public macro Hashable() = #externalMacro(module: "MacroDefinition", type: "HashableMacro")
#endif
#endif

View File

@@ -16,3 +16,9 @@ struct S {}
// CHECK-DUMP: extension S: Equatable {
// CHECK-DUMP: }
@Hashable
struct T {}
// CHECK-DUMP: extension T: Hashable {
// CHECK-DUMP: }