Skip to content

Commit c03c3b2

Browse files
authored
Merge pull request swiftlang#36592 from drexin/wip-remove-codable-enum-flag
[Frontend] Remove enable-experimental-enum-codable-derivation flag
2 parents 4ab808d + 9044752 commit c03c3b2

23 files changed

+24
-38
lines changed

include/swift/Basic/LangOptions.h

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

276-
/// Enable experimental derivation of `Codable` for enums.
277-
bool EnableExperimentalEnumCodableDerivation = false;
278-
279276
/// Disable the implicit import of the _Concurrency module.
280277
bool DisableImplicitConcurrencyModuleImport = false;
281278

include/swift/Option/FrontendOptions.td

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

240-
def enable_experimental_enum_codable_derivation :
241-
Flag<["-"], "enable-experimental-enum-codable-derivation">,
242-
HelpText<"Enable experimental derivation of Codable for enums">;
243-
244240
def enable_resilience : Flag<["-"], "enable-resilience">,
245241
HelpText<"Deprecated, use -enable-library-evolution instead">;
246242
}

lib/Frontend/CompilerInvocation.cpp

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

397-
Opts.EnableExperimentalEnumCodableDerivation |=
398-
Args.hasArg(OPT_enable_experimental_enum_codable_derivation);
399-
400397
Opts.DisableImplicitConcurrencyModuleImport |=
401398
Args.hasArg(OPT_disable_implicit_concurrency_module_import);
402399

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/IRGen/synthesized_conformance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -disable-generic-metadata-prespecialization -emit-ir %s -swift-version 4 -enable-experimental-enum-codable-derivation | %FileCheck %s
1+
// RUN: %target-swift-frontend -disable-generic-metadata-prespecialization -emit-ir %s -swift-version 4 | %FileCheck %s
22

33
struct Struct<T> {
44
var x: T

test/IRGen/synthesized_conformance_future.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -prespecialize-generic-metadata -target %module-target-future -emit-ir %s -swift-version 4 -enable-experimental-enum-codable-derivation | %FileCheck %s -DINT=i%target-ptrsize -DALIGNMENT=%target-alignment
1+
// RUN: %target-swift-frontend -prespecialize-generic-metadata -target %module-target-future -emit-ir %s -swift-version 4 | %FileCheck %s -DINT=i%target-ptrsize -DALIGNMENT=%target-alignment
22

33
// REQUIRES: VENDOR=apple || OS=linux-gnu
44
// UNSUPPORTED: CPU=i386 && OS=ios

test/SILGen/synthesized_conformance_enum.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -emit-silgen %s -swift-version 4 -enable-experimental-enum-codable-derivation | %FileCheck -check-prefix CHECK -check-prefix CHECK-FRAGILE %s
2-
// RUN: %target-swift-frontend -emit-silgen %s -swift-version 4 -enable-library-evolution -enable-experimental-enum-codable-derivation | %FileCheck -check-prefix CHECK -check-prefix CHECK-RESILIENT %s
1+
// RUN: %target-swift-frontend -emit-silgen %s -swift-version 4 | %FileCheck -check-prefix CHECK -check-prefix CHECK-FRAGILE %s
2+
// RUN: %target-swift-frontend -emit-silgen %s -swift-version 4 -enable-library-evolution | %FileCheck -check-prefix CHECK -check-prefix CHECK-RESILIENT %s
33

44
enum Enum<T> {
55
case a(T), b(T)

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'}}

0 commit comments

Comments
 (0)