mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Macros] Add back the ExtensionMacro feature identifier as a language feature
that can be used in swiftinterfaces.
This commit is contained in:
@@ -105,6 +105,7 @@ LANGUAGE_FEATURE(
|
|||||||
FreestandingExpressionMacros, 382, "Expression macros",
|
FreestandingExpressionMacros, 382, "Expression macros",
|
||||||
hasSwiftSwiftParser)
|
hasSwiftSwiftParser)
|
||||||
LANGUAGE_FEATURE(AttachedMacros, 389, "Attached 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(MoveOnly, 390, "noncopyable types", true)
|
||||||
LANGUAGE_FEATURE(ParameterPacks, 393, "Value and type parameter packs", true)
|
LANGUAGE_FEATURE(ParameterPacks, 393, "Value and type parameter packs", true)
|
||||||
SUPPRESSIBLE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexicalLifetimes annotations", true)
|
SUPPRESSIBLE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexicalLifetimes annotations", true)
|
||||||
|
|||||||
@@ -3,3 +3,10 @@
|
|||||||
|
|
||||||
@attached(conformance)
|
@attached(conformance)
|
||||||
public macro Equatable() = #externalMacro(module: "MacroDefinition", type: "EquatableMacro")
|
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
|
||||||
|
|||||||
@@ -16,3 +16,9 @@ struct S {}
|
|||||||
|
|
||||||
// CHECK-DUMP: extension S: Equatable {
|
// CHECK-DUMP: extension S: Equatable {
|
||||||
// CHECK-DUMP: }
|
// CHECK-DUMP: }
|
||||||
|
|
||||||
|
@Hashable
|
||||||
|
struct T {}
|
||||||
|
|
||||||
|
// CHECK-DUMP: extension T: Hashable {
|
||||||
|
// CHECK-DUMP: }
|
||||||
|
|||||||
Reference in New Issue
Block a user