@@ -5548,48 +5548,49 @@ END_CAN_TYPE_WRAPPER(PrimaryArchetypeType, ArchetypeType)
5548
5548
5549
5549
// / An archetype that represents an opaque type.
5550
5550
class OpaqueTypeArchetypeType final : public ArchetypeType,
5551
- public llvm::FoldingSetNode,
5552
5551
private ArchetypeTrailingObjects<OpaqueTypeArchetypeType>
5553
5552
{
5554
5553
friend TrailingObjects;
5555
5554
friend ArchetypeType;
5556
5555
friend GenericSignatureBuilder;
5557
5556
5558
- // / The declaration that defines the opaque type.
5559
- OpaqueTypeDecl *OpaqueDecl;
5560
- // / The substitutions into the interface signature of the opaque type.
5561
- SubstitutionMap Substitutions;
5562
-
5563
5557
// / A GenericEnvironment with this opaque archetype bound to the interface
5564
5558
// / type of the output type from the OpaqueDecl.
5565
- GenericEnvironment *Environment;
5566
-
5559
+ GenericEnvironment *Environment = nullptr ;
5560
+
5561
+ friend class GenericEnvironment ;
5562
+
5563
+ static OpaqueTypeArchetypeType *getNew (
5564
+ GenericEnvironment *environment, Type interfaceType,
5565
+ ArrayRef<ProtocolDecl*> conformsTo, Type superclass,
5566
+ LayoutConstraint layout);
5567
+
5567
5568
public:
5568
5569
// / Get an opaque archetype representing the underlying type of the given
5569
5570
// / opaque type decl's opaque param with ordinal `ordinal`. For example, in
5570
5571
// / `(some P, some Q)`, `some P`'s type param would have ordinal 0 and `some
5571
5572
// / Q`'s type param would have ordinal 1.
5572
- static OpaqueTypeArchetypeType *get (OpaqueTypeDecl *Decl, unsigned ordinal,
5573
- SubstitutionMap Substitutions);
5573
+ static Type get (OpaqueTypeDecl *decl, unsigned ordinal, SubstitutionMap subs);
5574
+
5575
+ // / Retrieve the opaque type declaration.
5576
+ OpaqueTypeDecl *getDecl () const ;
5577
+
5578
+ // / Retrieve the set of substitutions applied to the opaque type.
5579
+ SubstitutionMap getSubstitutions () const ;
5574
5580
5575
- OpaqueTypeDecl *getDecl () const {
5576
- return OpaqueDecl;
5577
- }
5578
- SubstitutionMap getSubstitutions () const {
5579
- return Substitutions;
5580
- }
5581
-
5582
5581
// / Get the generic signature used to build out this archetype. This is
5583
5582
// / equivalent to the OpaqueTypeDecl's interface generic signature, with
5584
5583
// / all of the generic parameters aside from the opaque type's interface
5585
5584
// / type same-type-constrained to their substitutions for this type.
5586
5585
GenericSignature getBoundSignature () const ;
5587
5586
5588
5587
// / Get a generic environment that has this opaque archetype bound within it.
5589
- GenericEnvironment *getGenericEnvironment () const {
5590
- return Environment;
5591
- }
5592
-
5588
+ GenericEnvironment *getGenericEnvironment () const ;
5589
+
5590
+ // / Compute the canonical interface type within the environment of this
5591
+ // / opaque type archetype.
5592
+ CanType getCanonicalInterfaceType (Type interfaceType);
5593
+
5593
5594
static bool classof (const TypeBase *T) {
5594
5595
return T->getKind () == TypeKind::OpaqueTypeArchetype;
5595
5596
}
@@ -5603,22 +5604,12 @@ class OpaqueTypeArchetypeType final : public ArchetypeType,
5603
5604
// / then the underlying type of `some P` would be ordinal 0, and `some Q` would be ordinal 1.
5604
5605
unsigned getOrdinal () const ;
5605
5606
5606
- static void Profile (llvm::FoldingSetNodeID &ID,
5607
- OpaqueTypeDecl *OpaqueDecl,
5608
- unsigned ordinal,
5609
- SubstitutionMap Substitutions);
5610
-
5611
- void Profile (llvm::FoldingSetNodeID &ID) {
5612
- Profile (ID, getDecl (), getOrdinal (), getSubstitutions ());
5613
- };
5614
-
5615
5607
private:
5616
- OpaqueTypeArchetypeType (OpaqueTypeDecl *OpaqueDecl,
5617
- SubstitutionMap Substitutions,
5618
- RecursiveTypeProperties Props,
5619
- Type InterfaceType,
5620
- ArrayRef<ProtocolDecl*> ConformsTo,
5621
- Type Superclass, LayoutConstraint Layout);
5608
+ OpaqueTypeArchetypeType (GenericEnvironment *environment,
5609
+ RecursiveTypeProperties properties,
5610
+ Type interfaceType,
5611
+ ArrayRef<ProtocolDecl*> conformsTo,
5612
+ Type superclass, LayoutConstraint layout);
5622
5613
};
5623
5614
BEGIN_CAN_TYPE_WRAPPER (OpaqueTypeArchetypeType, ArchetypeType)
5624
5615
END_CAN_TYPE_WRAPPER(OpaqueTypeArchetypeType, ArchetypeType)
0 commit comments