Skip to content

Commit e42cf5b

Browse files
committed
[Frontend] Remove enable-experimental-enum-codable-derivation flag
SE-295 has been accepted, so we don't need to hide the feature behind a flag anymore.
1 parent 00fd10e commit e42cf5b

20 files changed

+20
-34
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,6 @@ namespace swift {
256256
/// Enable inference of Sendable conformances for public types.
257257
bool EnableInferPublicSendable = false;
258258

259-
/// Enable experimental derivation of `Codable` for enums.
260-
bool EnableExperimentalEnumCodableDerivation = false;
261-
262259
/// Disable the implicit import of the _Concurrency module.
263260
bool DisableImplicitConcurrencyModuleImport = false;
264261

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,6 @@ def enable_experimental_flow_sensitive_concurrent_captures :
233233
Flag<["-"], "enable-experimental-flow-sensitive-concurrent-captures">,
234234
HelpText<"Enable flow-sensitive concurrent captures">;
235235

236-
def enable_experimental_enum_codable_derivation :
237-
Flag<["-"], "enable-experimental-enum-codable-derivation">,
238-
HelpText<"Enable experimental derivation of Codable for enums">;
239-
240236
def enable_resilience : Flag<["-"], "enable-resilience">,
241237
HelpText<"Deprecated, use -enable-library-evolution instead">;
242238
}

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
392392
Opts.EnableExperimentalFlowSensitiveConcurrentCaptures |=
393393
Args.hasArg(OPT_enable_experimental_flow_sensitive_concurrent_captures);
394394

395-
Opts.EnableExperimentalEnumCodableDerivation |=
396-
Args.hasArg(OPT_enable_experimental_enum_codable_derivation);
397-
398395
Opts.DisableImplicitConcurrencyModuleImport |=
399396
Args.hasArg(OPT_disable_implicit_concurrency_module_import);
400397

lib/Sema/DerivedConformanceCodable.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,9 +2014,7 @@ static bool canDeriveCodable(NominalTypeDecl *NTD,
20142014
// Structs, classes and enums can explicitly derive Encodable and Decodable
20152015
// conformance (explicitly meaning we can synthesize an implementation if
20162016
// a type conforms manually).
2017-
if (!isa<StructDecl>(NTD) && !isa<ClassDecl>(NTD) &&
2018-
!(NTD->getASTContext().LangOpts.EnableExperimentalEnumCodableDerivation
2019-
&& isa<EnumDecl>(NTD))) {
2017+
if (!isa<StructDecl>(NTD) && !isa<ClassDecl>(NTD) && !isa<EnumDecl>(NTD)) {
20202018
return false;
20212019
}
20222020

@@ -2039,8 +2037,7 @@ bool DerivedConformance::canDeriveEncodable(NominalTypeDecl *NTD) {
20392037
ValueDecl *DerivedConformance::deriveEncodable(ValueDecl *requirement) {
20402038
// We can only synthesize Encodable for structs and classes.
20412039
if (!isa<StructDecl>(Nominal) && !isa<ClassDecl>(Nominal) &&
2042-
!(Context.LangOpts.EnableExperimentalEnumCodableDerivation
2043-
&& isa<EnumDecl>(Nominal)))
2040+
!isa<EnumDecl>(Nominal))
20442041
return nullptr;
20452042

20462043
if (requirement->getBaseName() != Context.Id_encode) {
@@ -2070,8 +2067,7 @@ ValueDecl *DerivedConformance::deriveEncodable(ValueDecl *requirement) {
20702067
ValueDecl *DerivedConformance::deriveDecodable(ValueDecl *requirement) {
20712068
// We can only synthesize Encodable for structs and classes.
20722069
if (!isa<StructDecl>(Nominal) && !isa<ClassDecl>(Nominal) &&
2073-
!(Context.LangOpts.EnableExperimentalEnumCodableDerivation
2074-
&& isa<EnumDecl>(Nominal)))
2070+
!isa<EnumDecl>(Nominal))
20752071
return nullptr;
20762072

20772073
if (requirement->getBaseName() != DeclBaseName::createConstructor()) {

test/decl/protocol/special/coding/enum_codable_case_identifier_overloads.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -enable-experimental-enum-codable-derivation
1+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown
22

33
// Simple enums with all Codable parameters whose CodingKeys come from a
44
// typealias should get derived conformance to Codable.

test/decl/protocol/special/coding/enum_codable_codingkeys_typealias.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -enable-experimental-enum-codable-derivation
1+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown
22

33
// Simple enums with all Codable parameters whose CodingKeys come from a
44
// typealias should get derived conformance to Codable.

test/decl/protocol/special/coding/enum_codable_conflicting_parameter_identifier.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -enable-experimental-enum-codable-derivation
1+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown
22

33
enum Duplicate : Codable { // expected-error {{type 'Duplicate' does not conform to protocol 'Decodable'}}
44
// expected-error@-1 {{type 'Duplicate' does not conform to protocol 'Encodable'}}

test/decl/protocol/special/coding/enum_codable_excluded_optional_properties.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -enable-experimental-enum-codable-derivation
1+
// RUN: %target-typecheck-verify-swift
22

33
enum EnumWithNonExcludedOptionalParameters : Codable { // expected-error {{type 'EnumWithNonExcludedOptionalParameters' does not conform to protocol 'Decodable'}}
44
// expected-error@-1 {{type 'EnumWithNonExcludedOptionalParameters' does not conform to protocol 'Encodable'}}

test/decl/protocol/special/coding/enum_codable_failure_diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -parse-as-library -swift-version 4 %s -verify -enable-experimental-enum-codable-derivation
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -parse-as-library -swift-version 4 %s -verify
22

33
// Codable enum with non-Codable parameter.
44
enum E1 : Codable {

test/decl/protocol/special/coding/enum_codable_ignore_nonconforming_property.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -enable-experimental-enum-codable-derivation
1+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown
22

33
struct NonCodable {}
44

0 commit comments

Comments
 (0)