Skip to content

Commit 6267513

Browse files
committed
Add experimental feature for AdditiveArithmetic derived conformances
1 parent 22ccb3f commit 6267513

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

include/swift/Basic/Features.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ EXPERIMENTAL_FEATURE(DifferentiableProgramming)
115115
/// Whether to enable forward mode differentiation.
116116
EXPERIMENTAL_FEATURE(ForwardModeDifferentiation)
117117

118+
/// Whether to enable experimental `AdditiveArithmetic` derived
119+
/// conformances.
120+
EXPERIMENTAL_FEATURE(AdditiveArithmeticDerivedConformances)
118121

119122
#undef EXPERIMENTAL_FEATURE
120123
#undef FUTURE_FEATURE

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,6 @@ namespace swift {
426426
/// file.
427427
bool EmitFineGrainedDependencySourcefileDotFiles = false;
428428

429-
/// Whether to enable experimental `AdditiveArithmetic` derived
430-
/// conformances.
431-
bool EnableExperimentalAdditiveArithmeticDerivedConformances = false;
432-
433429
/// Enable verification when every SubstitutionMap is constructed.
434430
bool VerifyAllSubstitutionMaps = false;
435431

lib/AST/ASTPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3047,6 +3047,10 @@ static bool usesFeatureForwardModeDifferentiation(Decl *decl) {
30473047
return false;
30483048
}
30493049

3050+
static bool usesFeatureAdditiveArithmeticDerivedConformances(Decl *decl) {
3051+
return false;
3052+
}
3053+
30503054
static void
30513055
suppressingFeatureNoAsyncAvailability(PrintOptions &options,
30523056
llvm::function_ref<void()> action) {

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
544544
if (Args.hasArg(OPT_emit_fine_grained_dependency_sourcefile_dot_files))
545545
Opts.EmitFineGrainedDependencySourcefileDotFiles = true;
546546

547-
if (Args.hasArg(OPT_enable_experimental_additive_arithmetic_derivation))
548-
Opts.EnableExperimentalAdditiveArithmeticDerivedConformances = true;
549-
550547
Opts.DebuggerSupport |= Args.hasArg(OPT_debugger_support);
551548
if (Opts.DebuggerSupport)
552549
Opts.EnableDollarIdentifiers = true;
@@ -664,6 +661,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
664661
Opts.Features.insert(Feature::BoundGenericExtensions);
665662
if (Args.hasArg(OPT_enable_experimental_forward_mode_differentiation))
666663
Opts.Features.insert(Feature::ForwardModeDifferentiation);
664+
if (Args.hasArg(OPT_enable_experimental_additive_arithmetic_derivation))
665+
Opts.Features.insert(Feature::AdditiveArithmeticDerivedConformances);
667666

668667
Opts.EnableAppExtensionRestrictions |= Args.hasArg(OPT_enable_app_extension);
669668

lib/Sema/TypeChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ bool swift::isAdditiveArithmeticConformanceDerivationEnabled(SourceFile &SF) {
379379
auto &ctx = SF.getASTContext();
380380
// Return true if `AdditiveArithmetic` derived conformances are explicitly
381381
// enabled.
382-
if (ctx.LangOpts.EnableExperimentalAdditiveArithmeticDerivedConformances)
382+
if (ctx.LangOpts.hasFeature(Feature::AdditiveArithmeticDerivedConformances))
383383
return true;
384384
// Otherwise, return true iff differentiable programming is enabled.
385385
// Differentiable programming depends on `AdditiveArithmetic` derived

0 commit comments

Comments
 (0)