@@ -3417,7 +3417,7 @@ DynamicallyReplacedDeclRequest::evaluate(Evaluator &evaluator,
3417
3417
}
3418
3418
3419
3419
// / Returns true if the given type conforms to `Differentiable` in the given
3420
- // / contxt . If `tangentVectorEqualsSelf` is true, also check whether the given
3420
+ // / context . If `tangentVectorEqualsSelf` is true, also check whether the given
3421
3421
// / type satisfies `TangentVector == Self`.
3422
3422
static bool conformsToDifferentiable (Type type, DeclContext *DC,
3423
3423
bool tangentVectorEqualsSelf = false ) {
@@ -3480,13 +3480,13 @@ IndexSubset *TypeChecker::inferDifferentiabilityParameters(
3480
3480
return IndexSubset::get (ctx, parameterBits);
3481
3481
}
3482
3482
3483
- // Computes the differentiability parameter indices from the given parsed
3484
- // differentiability parameters for the given original or derivative
3485
- // `AbstractFunctionDecl` and derivative generic environment. On error, emits
3486
- // diagnostics and returns `nullptr`.
3487
- // - If parsed parameters are empty, infer parameter indices.
3488
- // - Otherwise, build parameter indices from parsed parameters.
3489
- // The attribute name/location are used in diagnostics.
3483
+ // / Computes the differentiability parameter indices from the given parsed
3484
+ // / differentiability parameters for the given original or derivative
3485
+ // / `AbstractFunctionDecl` and derivative generic environment. On error, emits
3486
+ // / diagnostics and returns `nullptr`.
3487
+ // / - If parsed parameters are empty, infer parameter indices.
3488
+ // / - Otherwise, build parameter indices from parsed parameters.
3489
+ // / The attribute name/location are used in diagnostics.
3490
3490
static IndexSubset *computeDifferentiabilityParameters (
3491
3491
ArrayRef<ParsedAutoDiffParameter> parsedDiffParams,
3492
3492
AbstractFunctionDecl *function, GenericEnvironment *derivativeGenEnv,
@@ -3645,17 +3645,17 @@ enum class AbstractFunctionDeclLookupErrorKind {
3645
3645
CandidateNotFunctionDeclaration
3646
3646
};
3647
3647
3648
- // Returns the function declaration corresponding to the given base type
3649
- // (optional), function name, and lookup context.
3650
- //
3651
- // If the base type of the function is specified, member lookup is performed.
3652
- // Otherwise, unqualified lookup is performed.
3653
- //
3654
- // If the function declaration cannot be resolved, emits a diagnostic and
3655
- // returns nullptr.
3656
- //
3657
- // Used for resolving the referenced declaration in `@derivative` and
3658
- // `@transpose` attributes.
3648
+ // / Returns the function declaration corresponding to the given base type
3649
+ // / (optional), function name, and lookup context.
3650
+ // /
3651
+ // / If the base type of the function is specified, member lookup is performed.
3652
+ // / Otherwise, unqualified lookup is performed.
3653
+ // /
3654
+ // / If the function declaration cannot be resolved, emits a diagnostic and
3655
+ // / returns nullptr.
3656
+ // /
3657
+ // / Used for resolving the referenced declaration in `@derivative` and
3658
+ // / `@transpose` attributes.
3659
3659
static AbstractFunctionDecl *findAbstractFunctionDecl (
3660
3660
DeclAttribute *attr, Type baseType, DeclNameRefWithLoc funcNameWithLoc,
3661
3661
DeclContext *lookupContext, NameLookupOptions lookupOptions,
@@ -3818,10 +3818,10 @@ static AbstractFunctionDecl *findAbstractFunctionDecl(
3818
3818
return validCandidates.front ();
3819
3819
}
3820
3820
3821
- // Checks that the `candidate` function type equals the `required` function
3822
- // type, disregarding parameter labels and tuple result labels.
3823
- // `checkGenericSignature` is used to check generic signatures, if specified.
3824
- // Otherwise, generic signatures are checked for equality.
3821
+ // / Checks that the `candidate` function type equals the `required` function
3822
+ // / type, disregarding parameter labels and tuple result labels.
3823
+ // / `checkGenericSignature` is used to check generic signatures, if specified.
3824
+ // / Otherwise, generic signatures are checked for equality.
3825
3825
static bool checkFunctionSignature (
3826
3826
CanAnyFunctionType required, CanType candidate,
3827
3827
Optional<std::function<bool (GenericSignature, GenericSignature)>>
@@ -3890,8 +3890,8 @@ static bool checkFunctionSignature(
3890
3890
return checkFunctionSignature (requiredResultFnTy, candidateResultTy);
3891
3891
};
3892
3892
3893
- // Returns an `AnyFunctionType` from the given parameters, result type, and
3894
- // generic signature.
3893
+ // / Returns an `AnyFunctionType` from the given parameters, result type, and
3894
+ // / generic signature.
3895
3895
static AnyFunctionType *
3896
3896
makeFunctionType (ArrayRef<AnyFunctionType::Param> parameters, Type resultType,
3897
3897
GenericSignature genericSignature) {
@@ -3900,8 +3900,8 @@ makeFunctionType(ArrayRef<AnyFunctionType::Param> parameters, Type resultType,
3900
3900
return FunctionType::get (parameters, resultType);
3901
3901
}
3902
3902
3903
- // Computes the original function type corresponding to the given derivative
3904
- // function type. Used for `@derivative` attribute type-checking.
3903
+ // / Computes the original function type corresponding to the given derivative
3904
+ // / function type. Used for `@derivative` attribute type-checking.
3905
3905
static AnyFunctionType *
3906
3906
getDerivativeOriginalFunctionType (AnyFunctionType *derivativeFnTy) {
3907
3907
// Unwrap curry levels. At most, two parameter lists are necessary, for
@@ -3940,8 +3940,8 @@ getDerivativeOriginalFunctionType(AnyFunctionType *derivativeFnTy) {
3940
3940
return originalType;
3941
3941
}
3942
3942
3943
- // Computes the original function type corresponding to the given transpose
3944
- // function type. Used for `@transpose` attribute type-checking.
3943
+ // / Computes the original function type corresponding to the given transpose
3944
+ // / function type. Used for `@transpose` attribute type-checking.
3945
3945
static AnyFunctionType *
3946
3946
getTransposeOriginalFunctionType (AnyFunctionType *transposeFnType,
3947
3947
IndexSubset *linearParamIndices,
@@ -4878,11 +4878,11 @@ DerivativeAttrOriginalDeclRequest::evaluate(Evaluator &evaluator,
4878
4878
return nullptr ;
4879
4879
}
4880
4880
4881
- // Computes the linearity parameter indices from the given parsed linearity
4882
- // parameters for the given transpose function. On error, emits diagnostics and
4883
- // returns `nullptr`.
4884
- //
4885
- // The attribute location is used in diagnostics.
4881
+ // / Computes the linearity parameter indices from the given parsed linearity
4882
+ // / parameters for the given transpose function. On error, emits diagnostics and
4883
+ // / returns `nullptr`.
4884
+ // /
4885
+ // / The attribute location is used in diagnostics.
4886
4886
static IndexSubset *
4887
4887
computeLinearityParameters (ArrayRef<ParsedAutoDiffParameter> parsedLinearParams,
4888
4888
AbstractFunctionDecl *transposeFunction,
@@ -4969,12 +4969,12 @@ computeLinearityParameters(ArrayRef<ParsedAutoDiffParameter> parsedLinearParams,
4969
4969
return IndexSubset::get (ctx, parameterBits);
4970
4970
}
4971
4971
4972
- // Checks if the given linearity parameter types are valid for the given
4973
- // original function in the given derivative generic environment and module
4974
- // context. Returns true on error.
4975
- //
4976
- // The parsed differentiability parameters and attribute location are used in
4977
- // diagnostics.
4972
+ // / Checks if the given linearity parameter types are valid for the given
4973
+ // / original function in the given derivative generic environment and module
4974
+ // / context. Returns true on error.
4975
+ // /
4976
+ // / The parsed differentiability parameters and attribute location are used in
4977
+ // / diagnostics.
4978
4978
static bool checkLinearityParameters (
4979
4979
AbstractFunctionDecl *originalAFD,
4980
4980
SmallVector<AnyFunctionType::Param, 4 > linearParams,
@@ -5007,9 +5007,9 @@ static bool checkLinearityParameters(
5007
5007
return false ;
5008
5008
}
5009
5009
5010
- // Given a transpose function type where `self` is a linearity parameter,
5011
- // sets `staticSelfType` and `instanceSelfType` and returns true if they are
5012
- // equals. Otherwise, returns false.
5010
+ // / Given a transpose function type where `self` is a linearity parameter,
5011
+ // / sets `staticSelfType` and `instanceSelfType` and returns true if they are
5012
+ // / equals. Otherwise, returns false.
5013
5013
static bool
5014
5014
doTransposeStaticAndInstanceSelfTypesMatch (AnyFunctionType *transposeType,
5015
5015
Type &staticSelfType,
@@ -5170,7 +5170,8 @@ void AttributeChecker::visitTransposeAttr(TransposeAttr *attr) {
5170
5170
5171
5171
// Diagnose if original function has opaque result types.
5172
5172
if (auto *opaqueResultTypeDecl = originalAFD->getOpaqueResultTypeDecl ()) {
5173
- diagnose (attr->getLocation (), diag::autodiff_attr_opaque_result_type_unsupported);
5173
+ diagnose (attr->getLocation (),
5174
+ diag::autodiff_attr_opaque_result_type_unsupported);
5174
5175
attr->setInvalid ();
5175
5176
return ;
5176
5177
}
0 commit comments