@@ -3663,14 +3663,13 @@ resolveDifferentiableAttrOriginalFunction(DifferentiableAttr *attr) {
3663
3663
}
3664
3664
3665
3665
// / Given a `@differentiable` attribute, attempts to resolve the derivative
3666
- // / generic environment . The derivative generic environment is returned as
3667
- // / `derivativeGenEnv `. On error, emits diagnostic, assigns `nullptr` to
3668
- // / `derivativeGenEnv `, and returns true.
3669
- bool resolveDifferentiableAttrDerivativeGenericEnvironment (
3666
+ // / generic signature . The derivative generic signature is returned as
3667
+ // / `derivativeGenSig `. On error, emits diagnostic, assigns `nullptr` to
3668
+ // / `derivativeGenSig `, and returns true.
3669
+ bool resolveDifferentiableAttrDerivativeGenericSignature (
3670
3670
DifferentiableAttr *attr, AbstractFunctionDecl *original,
3671
- GenericSignature &derivativeGenSig, GenericEnvironment *&derivativeGenEnv ) {
3671
+ GenericSignature &derivativeGenSig) {
3672
3672
derivativeGenSig = nullptr ;
3673
- derivativeGenEnv = nullptr ;
3674
3673
3675
3674
auto &ctx = original->getASTContext ();
3676
3675
auto &diags = ctx.Diags ;
@@ -3763,10 +3762,9 @@ bool resolveDifferentiableAttrDerivativeGenericEnvironment(
3763
3762
return true ;
3764
3763
}
3765
3764
3766
- // Compute generic signature and environment for derivative functions.
3765
+ // Compute generic signature for derivative functions.
3767
3766
derivativeGenSig = std::move (builder).computeGenericSignature (
3768
3767
attr->getLocation (), /* allowConcreteGenericParams=*/ true );
3769
- derivativeGenEnv = derivativeGenSig->getGenericEnvironment ();
3770
3768
}
3771
3769
3772
3770
// Set the resolved derivative generic signature in the attribute.
@@ -3993,13 +3991,14 @@ llvm::Expected<IndexSubset *> DifferentiableAttributeTypeCheckRequest::evaluate(
3993
3991
}
3994
3992
}
3995
3993
3996
- // Resolve the derivative generic environment .
3994
+ // Resolve the derivative generic signature .
3997
3995
GenericSignature derivativeGenSig;
3998
- GenericEnvironment *derivativeGenEnv = nullptr ;
3999
- if (resolveDifferentiableAttrDerivativeGenericEnvironment (attr, original,
4000
- derivativeGenSig,
4001
- derivativeGenEnv))
3996
+ if (resolveDifferentiableAttrDerivativeGenericSignature (attr, original,
3997
+ derivativeGenSig))
4002
3998
return nullptr ;
3999
+ GenericEnvironment *derivativeGenEnv = nullptr ;
4000
+ if (derivativeGenSig)
4001
+ derivativeGenEnv = derivativeGenSig->getGenericEnvironment ();
4003
4002
4004
4003
// Compute the derivative function type.
4005
4004
auto derivativeFnTy = originalFnTy;
0 commit comments