@@ -231,17 +231,19 @@ CanSILFunctionType SILFunctionType::getAutoDiffAssociatedFunctionType(
231
231
case AutoDiffAssociatedFunctionKind::JVP: {
232
232
SmallVector<SILParameterInfo, 8 > differentialParams;
233
233
for (auto ¶m : wrtParams) {
234
+ auto paramTan =
235
+ param.getType ()->getAutoDiffAssociatedTangentSpace (lookupConformance);
236
+ assert (paramTan && " Parameter type does not have a tangent space?" );
234
237
differentialParams.push_back (
235
- {param.getType ()->getAutoDiffAssociatedTangentSpace (lookupConformance)
236
- ->getCanonicalType (),
237
- param.getConvention ()});
238
+ {paramTan->getCanonicalType (), param.getConvention ()});
238
239
}
239
240
SmallVector<SILResultInfo, 8 > differentialResults;
240
241
auto &result = getResults ()[resultIndex];
242
+ auto resultTan =
243
+ result.getType ()->getAutoDiffAssociatedTangentSpace (lookupConformance);
244
+ assert (resultTan && " Result type does not have a tangent space?" );
241
245
differentialResults.push_back (
242
- {result.getType ()->getAutoDiffAssociatedTangentSpace (lookupConformance)
243
- ->getCanonicalType (),
244
- result.getConvention ()});
246
+ {resultTan->getCanonicalType (), result.getConvention ()});
245
247
closureType = SILFunctionType::get (
246
248
/* genericSignature*/ nullptr , ExtInfo (), SILCoroutineKind::None,
247
249
ParameterConvention::Direct_Guaranteed, differentialParams, {},
@@ -251,19 +253,19 @@ CanSILFunctionType SILFunctionType::getAutoDiffAssociatedFunctionType(
251
253
case AutoDiffAssociatedFunctionKind::VJP: {
252
254
SmallVector<SILParameterInfo, 8 > pullbackParams;
253
255
auto &origRes = getResults ()[resultIndex];
254
- auto tangentAssocTy =
255
- origRes.getType ()->getAutoDiffAssociatedTangentSpace (lookupConformance)
256
- -> getCanonicalType ( );
256
+ auto resultTan =
257
+ origRes.getType ()->getAutoDiffAssociatedTangentSpace (lookupConformance);
258
+ assert (resultTan && " Result type does not have a tangent space? " );
257
259
pullbackParams.push_back (
258
- getTangentParameterInfoForOriginalResult (tangentAssocTy ,
260
+ getTangentParameterInfoForOriginalResult (resultTan-> getCanonicalType () ,
259
261
origRes.getConvention ()));
260
262
SmallVector<SILResultInfo, 8 > pullbackResults;
261
263
for (auto ¶m : wrtParams) {
262
- auto paramTangentTy =
263
- param.getType ()->getAutoDiffAssociatedTangentSpace (lookupConformance)
264
- -> getCanonicalType ( );
264
+ auto paramTan =
265
+ param.getType ()->getAutoDiffAssociatedTangentSpace (lookupConformance);
266
+ assert (paramTan && " Parameter type does not have a tangent space? " );
265
267
pullbackResults.push_back (
266
- getTangentResultInfoForOriginalParameter (paramTangentTy ,
268
+ getTangentResultInfoForOriginalParameter (paramTan-> getCanonicalType () ,
267
269
param.getConvention ()));
268
270
}
269
271
closureType = SILFunctionType::get (
0 commit comments