@@ -589,32 +589,11 @@ static void printDifferentiableAttrArguments(
589
589
if (!isLeadingClause)
590
590
stream << ' ' ;
591
591
stream << " where " ;
592
- std::function<Type (Type)> getInterfaceType;
593
- if (!original || !original->getGenericSignature ()) {
594
- getInterfaceType = [](Type Ty) -> Type { return Ty; };
595
- } else {
596
- // Use GenericSignature to produce user-friendly
597
- // names instead of something like 't_0_0'.
598
- auto genericSig = original->getGenericSignature ();
599
- assert (genericSig);
600
- getInterfaceType = [=](Type Ty) -> Type {
601
- return genericSig->getSugaredType (Ty);
602
- };
603
- }
604
592
interleave (requirementsToPrint, [&](Requirement req) {
605
593
if (const auto &originalGenSig = original->getGenericSignature ())
606
594
if (originalGenSig->isRequirementSatisfied (req))
607
595
return ;
608
- auto FirstTy = getInterfaceType (req.getFirstType ());
609
- if (req.getKind () != RequirementKind::Layout) {
610
- auto SecondTy = getInterfaceType (req.getSecondType ());
611
- Requirement ReqWithDecls (req.getKind (), FirstTy, SecondTy);
612
- ReqWithDecls.print (stream, Options);
613
- } else {
614
- Requirement ReqWithDecls (req.getKind (), FirstTy,
615
- req.getLayoutConstraint ());
616
- ReqWithDecls.print (stream, Options);
617
- }
596
+ req.print (stream, Options);
618
597
}, [&] {
619
598
stream << " , " ;
620
599
});
@@ -931,22 +910,13 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
931
910
if (auto sig = attr->getSpecializedSgnature ())
932
911
requirements = sig->getRequirements ();
933
912
934
- std::function<Type (Type)> GetInterfaceType;
935
913
auto *FnDecl = dyn_cast_or_null<AbstractFunctionDecl>(D);
936
- if (!FnDecl || !FnDecl->getGenericSignature ())
937
- GetInterfaceType = [](Type Ty) -> Type { return Ty; };
938
- else {
939
- // Use GenericSignature to produce user-friendly
940
- // names instead of something like t_0_0.
941
- auto GenericSig = FnDecl->getGenericSignature ();
942
- assert (GenericSig);
943
- GetInterfaceType = [=](Type Ty) -> Type {
944
- return GenericSig->getSugaredType (Ty);
945
- };
914
+ if (FnDecl && FnDecl->getGenericSignature ()) {
915
+ auto genericSig = FnDecl->getGenericSignature ();
946
916
947
917
if (auto sig = attr->getSpecializedSgnature ()) {
948
918
requirementsScratch = sig->requirementsNotSatisfiedBy (
949
- GenericSig );
919
+ genericSig );
950
920
requirements = requirementsScratch;
951
921
}
952
922
}
@@ -957,16 +927,7 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
957
927
958
928
interleave (requirements,
959
929
[&](Requirement req) {
960
- auto FirstTy = GetInterfaceType (req.getFirstType ());
961
- if (req.getKind () != RequirementKind::Layout) {
962
- auto SecondTy = GetInterfaceType (req.getSecondType ());
963
- Requirement ReqWithDecls (req.getKind (), FirstTy, SecondTy);
964
- ReqWithDecls.print (Printer, Options);
965
- } else {
966
- Requirement ReqWithDecls (req.getKind (), FirstTy,
967
- req.getLayoutConstraint ());
968
- ReqWithDecls.print (Printer, Options);
969
- }
930
+ req.print (Printer, Options);
970
931
},
971
932
[&] { Printer << " , " ; });
972
933
0 commit comments