@@ -897,20 +897,18 @@ namespace {
897
897
TC.getTypeLowering (origFnTy, getResilienceExpansion ())
898
898
});
899
899
for (AutoDiffAssociatedFunctionKind kind :
900
- {AutoDiffAssociatedFunctionKind::JVP,
901
- AutoDiffAssociatedFunctionKind::VJP}) {
900
+ {AutoDiffAssociatedFunctionKind::JVP,
901
+ AutoDiffAssociatedFunctionKind::VJP}) {
902
902
auto assocFnTy = origFnTy->getAutoDiffAssociatedFunctionType (
903
903
paramIndices, 0 , kind, TC,
904
904
LookUpConformanceInModule (&TC.M ));
905
905
auto silTy = SILType::getPrimitiveObjectType (assocFnTy);
906
- auto extractee = DifferentiableFunctionExtractee (kind);
907
-
908
- // A bug caused by implicit conversions caused us to get the wrong
909
- // extractee, so assert that we have the right extractee to prevent
910
- // reoccurrence of the bug.
911
- assert (extractee.getExtracteeAsAssociatedFunction () ==
912
- Optional<AutoDiffAssociatedFunctionKind>(kind));
913
-
906
+ DifferentiableFunctionExtractee extractee (kind);
907
+ // Assert that we have the right extractee. A terrible bug in the past
908
+ // was caused by implicit conversions from `unsigned` to
909
+ // `DifferentiableFunctionExtractee` which resulted into a wrong
910
+ // extractee.
911
+ assert (extractee.getExtracteeAsAssociatedFunction () == kind);
914
912
children.push_back (Child{
915
913
extractee, TC.getTypeLowering (silTy, getResilienceExpansion ())});
916
914
}
0 commit comments