Skip to content
Merged
2 changes: 1 addition & 1 deletion include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6524,7 +6524,7 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
bool isIndirect() const {
return getAttrs().hasAttribute<IndirectAttr>();
}

/// Do not call this!
/// It exists to let the AST walkers get the raw value without forcing a request.
LiteralExpr *getRawValueUnchecked() const { return RawValueExpr; }
Expand Down
7 changes: 7 additions & 0 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -2908,6 +2908,13 @@ NOTE(decodable_suggest_overriding_init_here,none,
"did you mean to override 'init(from:)'?", ())
NOTE(codable_suggest_overriding_init_here,none,
"did you mean to override 'init(from:)' and 'encode(to:)'?", ())
NOTE(codable_enum_duplicate_case_name_here,none,
"cannot automatically synthesize %0 because %1 has duplicate "
"case name %2", (Type, Type, Identifier))
NOTE(codable_enum_duplicate_parameter_name_here,none,
"cannot automatically synthesize %0 for %1 because "
"user defined parameter name %2 in %3 conflicts with "
"automatically generated parameter name", (Type, Type, Identifier, Identifier))
Comment on lines +2911 to +2917
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We usually put the argument types on a separate line, partially to avoid line limit violations.


WARNING(decodable_property_will_not_be_decoded, none,
"immutable property will not be decoded because it is declared with "
Expand Down
10 changes: 10 additions & 0 deletions include/swift/AST/KnownIdentifiers.def
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

IDENTIFIER(AllCases)
IDENTIFIER(allCases)
IDENTIFIER(allKeys)
IDENTIFIER(alloc)
IDENTIFIER(allocWithZone)
IDENTIFIER(allZeros)
Expand All @@ -43,16 +44,20 @@ IDENTIFIER(callAsFunction)
IDENTIFIER(Change)
IDENTIFIER_WITH_NAME(code_, "_code")
IDENTIFIER(CodingKeys)
IDENTIFIER(codingPath)
IDENTIFIER(combine)
IDENTIFIER_(Concurrency)
IDENTIFIER(container)
IDENTIFIER(Context)
IDENTIFIER(CoreGraphics)
IDENTIFIER(CoreMedia)
IDENTIFIER(CGFloat)
IDENTIFIER(CoreFoundation)
IDENTIFIER(count)
IDENTIFIER(CVarArg)
IDENTIFIER(Darwin)
IDENTIFIER(dealloc)
IDENTIFIER(debugDescription)
IDENTIFIER(Decodable)
IDENTIFIER(decode)
IDENTIFIER(decodeIfPresent)
Expand Down Expand Up @@ -82,18 +87,21 @@ IDENTIFIER(fromRaw)
IDENTIFIER(hash)
IDENTIFIER(hasher)
IDENTIFIER(hashValue)
IDENTIFIER(init)
IDENTIFIER(initialize)
IDENTIFIER(initStorage)
IDENTIFIER(initialValue)
IDENTIFIER(into)
IDENTIFIER(intValue)
IDENTIFIER(invalidValue)
IDENTIFIER(Key)
IDENTIFIER(KeyedDecodingContainer)
IDENTIFIER(KeyedEncodingContainer)
IDENTIFIER(keyedBy)
IDENTIFIER(keyPath)
IDENTIFIER(makeIterator)
IDENTIFIER(makeAsyncIterator)
IDENTIFIER(nestedContainer)
IDENTIFIER(Iterator)
IDENTIFIER(AsyncIterator)
IDENTIFIER(load)
Expand Down Expand Up @@ -134,6 +142,8 @@ IDENTIFIER(to)
IDENTIFIER(toRaw)
IDENTIFIER(Type)
IDENTIFIER(type)
IDENTIFIER(typeMismatch)
IDENTIFIER(underlyingError)
IDENTIFIER(Value)
IDENTIFIER(value)
IDENTIFIER_WITH_NAME(value_, "_value")
Expand Down
2 changes: 2 additions & 0 deletions include/swift/AST/KnownStdlibTypes.def
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ KNOWN_STDLIB_TYPE_DECL(Decoder, ProtocolDecl, 1)
KNOWN_STDLIB_TYPE_DECL(KeyedEncodingContainer, NominalTypeDecl, 1)
KNOWN_STDLIB_TYPE_DECL(KeyedDecodingContainer, NominalTypeDecl, 1)
KNOWN_STDLIB_TYPE_DECL(RangeReplaceableCollection, ProtocolDecl, 1)
KNOWN_STDLIB_TYPE_DECL(EncodingError, NominalTypeDecl, 0)
KNOWN_STDLIB_TYPE_DECL(DecodingError, NominalTypeDecl, 0)

KNOWN_STDLIB_TYPE_DECL(Result, NominalTypeDecl, 2)

Expand Down
3 changes: 3 additions & 0 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ namespace swift {
/// Enable experimental flow-sensitive concurrent captures.
bool EnableExperimentalFlowSensitiveConcurrentCaptures = false;

/// Enable experimental derivation of `Codable` for enums.
bool EnableExperimentalEnumCodableDerivation = false;

/// Disable the implicit import of the _Concurrency module.
bool DisableImplicitConcurrencyModuleImport = false;

Expand Down
4 changes: 4 additions & 0 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ def enable_experimental_flow_sensitive_concurrent_captures :
Flag<["-"], "enable-experimental-flow-sensitive-concurrent-captures">,
HelpText<"Enable flow-sensitive concurrent captures">;

def enable_experimental_enum_codable_derivation :
Flag<["-"], "enable-experimental-enum-codable-derivation">,
HelpText<"Enable experimental derivation of Codable for enums">;

def enable_resilience : Flag<["-"], "enable-resilience">,
HelpText<"Deprecated, use -enable-library-evolution instead">;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.EnableExperimentalFlowSensitiveConcurrentCaptures |=
Args.hasArg(OPT_enable_experimental_flow_sensitive_concurrent_captures);

Opts.EnableExperimentalEnumCodableDerivation |=
Args.hasArg(OPT_enable_experimental_enum_codable_derivation);

Opts.DisableImplicitConcurrencyModuleImport |=
Args.hasArg(OPT_disable_implicit_concurrency_module_import);

Expand Down
Loading