File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
test/AutoDiff/SILOptimizer Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -406,11 +406,33 @@ static CanGenericSignature buildDifferentiableGenericSignature(CanGenericSignatu
406
406
return t->isEqual (interfaceTy->getRootGenericParam ());
407
407
}) != genericParams.end ()) {
408
408
types.insert (interfaceTy->getCanonicalType ());
409
+
409
410
for (auto *proto : at->getConformsTo ()) {
410
411
reqs.push_back (Requirement (RequirementKind::Conformance,
411
412
interfaceTy,
412
413
proto->getDeclaredInterfaceType ()));
413
414
}
415
+
416
+ // The GSB would add conformance requirements if a nested type
417
+ // requirement involving a resolved DependentMemberType was added;
418
+ // eg, if you start with <T> and add T.[P]A == Int, it would also
419
+ // add the conformance requirement T : P.
420
+ //
421
+ // This was not an intended behavior on the part of the GSB, and the
422
+ // logic here is a complete mess, so just simulate the old behavior
423
+ // here.
424
+ auto parentTy = interfaceTy;
425
+ while (parentTy) {
426
+ if (auto memberTy = parentTy->getAs <DependentMemberType>()) {
427
+ parentTy = memberTy->getBase ();
428
+ if (auto *assocTy = memberTy->getAssocType ()) {
429
+ reqs.push_back (Requirement (RequirementKind::Conformance,
430
+ parentTy,
431
+ assocTy->getProtocol ()->getDeclaredInterfaceType ()));
432
+ }
433
+ } else
434
+ parentTy = Type ();
435
+ }
414
436
}
415
437
}
416
438
return false ;
Original file line number Diff line number Diff line change 1
- // RUN: %target-swift-emit-sil -verify %s | %FileCheck %s -check-prefix=CHECK-SIL
1
+ // RUN: %target-swift-emit-sil -verify %s -requirement-machine-abstract-signatures=verify | %FileCheck %s -check-prefix=CHECK-SIL
2
2
3
3
import _Differentiation
4
4
You can’t perform that action at this time.
0 commit comments