mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[AST/Sema] Add @extensible attribute on enum declarations
This attribute controls whether cross-module access to the declaration
needs `@unknown default:` because it's allowed to gain new cases even
if the module is non-resilient.
(cherry picked from commit a0ae93d3a8)
This commit is contained in:
@@ -876,6 +876,11 @@ SIMPLE_DECL_ATTR(constInitialized, ConstInitialized,
|
||||
168)
|
||||
DECL_ATTR_FEATURE_REQUIREMENT(ConstInitialized, CompileTimeValues)
|
||||
|
||||
SIMPLE_DECL_ATTR(extensible, Extensible,
|
||||
OnEnum,
|
||||
ABIStableToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove | ForbiddenInABIAttr,
|
||||
169)
|
||||
|
||||
SIMPLE_DECL_ATTR(concurrent, Concurrent,
|
||||
OnFunc | OnConstructor | OnSubscript | OnVar,
|
||||
ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove | UnconstrainedInABIAttr,
|
||||
|
||||
@@ -8711,6 +8711,19 @@ GROUPED_WARNING(
|
||||
"behavior",
|
||||
(StringRef))
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// MARK: @extensible Attribute
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ERROR(extensible_attr_on_frozen_type,none,
|
||||
"cannot use '@extensible' together with '@frozen'", ())
|
||||
|
||||
ERROR(extensible_attr_on_internal_type,none,
|
||||
"'@extensible' attribute can only be applied to public or package "
|
||||
"declarations, but %0 is "
|
||||
"%select{private|fileprivate|internal|%error|%error|%error}1",
|
||||
(DeclName, AccessLevel))
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// MARK: `using` declaration
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user