mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AutoDiff] Simplify conditions enabling differentiable programming. (#30765)
Previously, two conditions were necessary to enable differentiable programming: - Using the `-enable-experimental-differentiable-programming` frontend flag. - Importing the `_Differentiation` module. Importing the `_Differentiation` module is the true condition because it contains the required compiler-known `Differentiable` protocol. The frontend flag is redundant and cumbersome. Now, the frontend flag is removed. Importing `_Differentiation` is the only condition.
This commit is contained in:
@@ -56,9 +56,9 @@ static StringRef getMathOperatorName(MathOperator op) {
|
||||
bool DerivedConformance::canDeriveAdditiveArithmetic(NominalTypeDecl *nominal,
|
||||
DeclContext *DC) {
|
||||
// Experimental `AdditiveArithmetic` derivation must be enabled.
|
||||
auto &ctx = nominal->getASTContext();
|
||||
if (!ctx.LangOpts.EnableExperimentalAdditiveArithmeticDerivedConformances)
|
||||
return false;
|
||||
if (auto *SF = DC->getParentSourceFile())
|
||||
if (!isAdditiveArithmeticConformanceDerivationEnabled(*SF))
|
||||
return false;
|
||||
// Nominal type must be a struct. (No stored properties is okay.)
|
||||
auto *structDecl = dyn_cast<StructDecl>(nominal);
|
||||
if (!structDecl)
|
||||
|
||||
Reference in New Issue
Block a user