@@ -1508,17 +1508,13 @@ class GenericSignatureBuilder::PotentialArchetype {
1508
1508
// /
1509
1509
// / \c parentOrBuilder determines whether we have a nested type vs. a root.
1510
1510
union PAIdentifier {
1511
- // / The associated type or typealias for a resolved nested type.
1512
- TypeDecl *assocTypeOrConcrete ;
1511
+ // / The associated type for a resolved nested type.
1512
+ AssociatedTypeDecl *assocType ;
1513
1513
1514
1514
// / The generic parameter key for a root.
1515
1515
GenericParamKey genericParam;
1516
1516
1517
- PAIdentifier (AssociatedTypeDecl *assocType)
1518
- : assocTypeOrConcrete (assocType) { }
1519
-
1520
- PAIdentifier (TypeDecl *concreteDecl)
1521
- : assocTypeOrConcrete (concreteDecl) { }
1517
+ PAIdentifier (AssociatedTypeDecl *assocType) : assocType (assocType) {}
1522
1518
1523
1519
PAIdentifier (GenericParamKey genericParam) : genericParam (genericParam) { }
1524
1520
} identifier;
@@ -1562,17 +1558,11 @@ class GenericSignatureBuilder::PotentialArchetype {
1562
1558
// / that share a name.
1563
1559
llvm::MapVector<Identifier, StoredNestedType> NestedTypes;
1564
1560
1565
- // / \brief Construct a new potential archetype for an unresolved
1566
- // / associated type.
1567
- PotentialArchetype (PotentialArchetype *parent, Identifier name);
1568
-
1569
1561
// / \brief Construct a new potential archetype for a concrete declaration.
1570
- PotentialArchetype (PotentialArchetype *parent, TypeDecl *concreteDecl)
1571
- : parentOrContext(parent), identifier(concreteDecl)
1572
- {
1562
+ PotentialArchetype (PotentialArchetype *parent, AssociatedTypeDecl *assocType)
1563
+ : parentOrContext(parent), identifier(assocType) {
1573
1564
assert (parent != nullptr && " Not a nested type?" );
1574
- assert (!isa<AssociatedTypeDecl>(concreteDecl) ||
1575
- cast<AssociatedTypeDecl>(concreteDecl)->getOverriddenDecls ().empty ());
1565
+ assert (assocType->getOverriddenDecls ().empty ());
1576
1566
}
1577
1567
1578
1568
// / \brief Construct a new potential archetype for a generic parameter.
@@ -1602,16 +1592,9 @@ class GenericSignatureBuilder::PotentialArchetype {
1602
1592
}
1603
1593
1604
1594
// / Retrieve the type declaration to which this nested type was resolved.
1605
- TypeDecl *getResolvedType () const {
1606
- assert (getParent () && " Not an associated type" );
1607
- return identifier.assocTypeOrConcrete ;
1608
- }
1609
-
1610
- // / Retrieve the associated type to which this potential archetype
1611
- // / has been resolved.
1612
- AssociatedTypeDecl *getResolvedAssociatedType () const {
1595
+ AssociatedTypeDecl *getResolvedType () const {
1613
1596
assert (getParent () && " Not an associated type" );
1614
- return dyn_cast<AssociatedTypeDecl>( identifier.assocTypeOrConcrete ) ;
1597
+ return identifier.assocType ;
1615
1598
}
1616
1599
1617
1600
// / Determine whether this is a generic parameter.
@@ -1640,16 +1623,7 @@ class GenericSignatureBuilder::PotentialArchetype {
1640
1623
// / Retrieve the name of a nested potential archetype.
1641
1624
Identifier getNestedName () const {
1642
1625
assert (getParent () && " Not a nested type" );
1643
- return identifier.assocTypeOrConcrete ->getName ();
1644
- }
1645
-
1646
- // / Retrieve the concrete type declaration.
1647
- TypeDecl *getConcreteTypeDecl () const {
1648
- assert (getParent () && " not a nested type" );
1649
- if (isa<AssociatedTypeDecl>(identifier.assocTypeOrConcrete ))
1650
- return nullptr ;
1651
-
1652
- return identifier.assocTypeOrConcrete ;
1626
+ return identifier.assocType ->getName ();
1653
1627
}
1654
1628
1655
1629
// / Retrieve the set of nested types.
@@ -1692,12 +1666,12 @@ class GenericSignatureBuilder::PotentialArchetype {
1692
1666
// / protocol.
1693
1667
// /
1694
1668
// / \returns the potential archetype associated with the associated
1695
- // / type or typealias of the given protocol, unless the \c kind implies that
1669
+ // / type of the given protocol, unless the \c kind implies that
1696
1670
// / a potential archetype should not be created if it's missing.
1697
- PotentialArchetype *updateNestedTypeForConformance (
1698
- GenericSignatureBuilder &builder,
1699
- TypeDecl *type ,
1700
- ArchetypeResolutionKind kind);
1671
+ PotentialArchetype *
1672
+ updateNestedTypeForConformance ( GenericSignatureBuilder &builder,
1673
+ AssociatedTypeDecl *assocType ,
1674
+ ArchetypeResolutionKind kind);
1701
1675
1702
1676
// / Retrieve the dependent type that describes this potential
1703
1677
// / archetype.
0 commit comments