Merge pull request #78021 from jckarter/addressable-params-2

Add an `@_addressableSelf` attribute to mark the self param of methods as addressable.
This commit is contained in:
Joe Groff
2024-12-09 08:42:49 -08:00
committed by GitHub
11 changed files with 60 additions and 3 deletions

View File

@@ -513,7 +513,11 @@ DECL_ATTR(lifetime, Lifetime,
OnAccessor | OnConstructor | OnFunc | OnSubscript | LongAttribute | ABIBreakingToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove | AllowMultipleAttributes,
161)
LAST_DECL_ATTR(Lifetime)
SIMPLE_DECL_ATTR(_addressableSelf, AddressableSelf,
OnAccessor | OnConstructor | OnFunc | OnSubscript | ABIBreakingToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove | UserInaccessible,
162)
LAST_DECL_ATTR(AddressableSelf)
#undef DECL_ATTR_ALIAS
#undef CONTEXTUAL_DECL_ATTR_ALIAS

View File

@@ -309,6 +309,11 @@ ERROR(incorrect_explicit_closure_result_vs_return_type,none,
"declared closure result %0 is incompatible with return type %1",
(Type, Type))
ERROR(addressable_not_enabled,none,
"@_addressable is an experimental feature", ())
ERROR(addressableSelf_not_on_method,none,
"@_addressableSelf cannot be applied to non-member declarations", ())
ERROR(unsupported_closure_attr,none,
"%select{attribute |}0 '%1' is not supported on a closure",
(bool, StringRef))