@@ -563,39 +563,48 @@ class ProtocolCompositionTypeRef final : public TypeRef {
563
563
}
564
564
};
565
565
566
- class ParameterizedProtocolTypeRef final : public TypeRef {
566
+ class ConstrainedExistentialTypeRef final : public TypeRef {
567
567
const ProtocolCompositionTypeRef *Base;
568
- std::vector<const TypeRef *> Args ;
568
+ std::vector<TypeRefRequirement> Requirements ;
569
569
570
570
static TypeRefID Profile (const ProtocolCompositionTypeRef *Protocol,
571
- std::vector<const TypeRef *> Args ) {
571
+ std::vector<TypeRefRequirement> Requirements ) {
572
572
TypeRefID ID;
573
573
ID.addPointer (Protocol);
574
- for (auto Arg : Args) {
575
- ID.addPointer (Arg);
574
+ for (auto reqt : Requirements) {
575
+ ID.addPointer (reqt.getFirstType ());
576
+ if (reqt.getKind () != RequirementKind::Layout)
577
+ ID.addPointer (reqt.getSecondType ());
578
+ else
579
+ ID.addInteger (
580
+ unsigned (0 )); // FIXME: Layout constraints aren't implemented yet
581
+ ID.addInteger (unsigned (reqt.getKind ()));
576
582
}
577
583
return ID;
578
584
}
579
585
580
586
public:
581
- ParameterizedProtocolTypeRef (const ProtocolCompositionTypeRef *Protocol,
582
- std::vector<const TypeRef *> Args )
583
- : TypeRef(TypeRefKind::ParameterizedProtocol ), Base(Protocol),
584
- Args (Args ) {}
587
+ ConstrainedExistentialTypeRef (const ProtocolCompositionTypeRef *Protocol,
588
+ std::vector<TypeRefRequirement> Requirements )
589
+ : TypeRef(TypeRefKind::ConstrainedExistential ), Base(Protocol),
590
+ Requirements (Requirements ) {}
585
591
586
592
template <typename Allocator>
587
- static const ParameterizedProtocolTypeRef *
593
+ static const ConstrainedExistentialTypeRef *
588
594
create (Allocator &A, const ProtocolCompositionTypeRef *Protocol,
589
- std::vector<const TypeRef *> Args) {
590
- FIND_OR_CREATE_TYPEREF (A, ParameterizedProtocolTypeRef, Protocol, Args);
595
+ std::vector<TypeRefRequirement> Requirements) {
596
+ FIND_OR_CREATE_TYPEREF (A, ConstrainedExistentialTypeRef, Protocol,
597
+ Requirements);
591
598
}
592
599
593
600
const ProtocolCompositionTypeRef *getBase () const { return Base; }
594
601
595
- const std::vector<const TypeRef *> &getArgs () const { return Args; }
602
+ const std::vector<TypeRefRequirement> &getRequirements () const {
603
+ return Requirements;
604
+ }
596
605
597
606
static bool classof (const TypeRef *TR) {
598
- return TR->getKind () == TypeRefKind::ParameterizedProtocol ;
607
+ return TR->getKind () == TypeRefKind::ConstrainedExistential ;
599
608
}
600
609
};
601
610
0 commit comments