@@ -563,39 +563,48 @@ class ProtocolCompositionTypeRef final : public TypeRef {
563563 }
564564};
565565
566- class ParameterizedProtocolTypeRef final : public TypeRef {
566+ class ConstrainedExistentialTypeRef final : public TypeRef {
567567 const ProtocolCompositionTypeRef *Base;
568- std::vector<const TypeRef *> Args ;
568+ std::vector<TypeRefRequirement> Requirements ;
569569
570570 static TypeRefID Profile (const ProtocolCompositionTypeRef *Protocol,
571- std::vector<const TypeRef *> Args ) {
571+ std::vector<TypeRefRequirement> Requirements ) {
572572 TypeRefID ID;
573573 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 ()));
576582 }
577583 return ID;
578584 }
579585
580586public:
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 ) {}
585591
586592 template <typename Allocator>
587- static const ParameterizedProtocolTypeRef *
593+ static const ConstrainedExistentialTypeRef *
588594 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);
591598 }
592599
593600 const ProtocolCompositionTypeRef *getBase () const { return Base; }
594601
595- const std::vector<const TypeRef *> &getArgs () const { return Args; }
602+ const std::vector<TypeRefRequirement> &getRequirements () const {
603+ return Requirements;
604+ }
596605
597606 static bool classof (const TypeRef *TR) {
598- return TR->getKind () == TypeRefKind::ParameterizedProtocol ;
607+ return TR->getKind () == TypeRefKind::ConstrainedExistential ;
599608 }
600609};
601610
0 commit comments