@@ -63,10 +63,6 @@ class DiagnosticEngine;
63
63
64
64
// / Determines how to resolve a dependent type to a potential archetype.
65
65
enum class ArchetypeResolutionKind {
66
- // / Always create a new potential archetype to describe this dependent type,
67
- // / which might be invalid and may not provide complete information.
68
- AlwaysPartial,
69
-
70
66
// / Only create a potential archetype when it is well-formed (e.g., a nested
71
67
// / type should exist) and make sure we have complete information about
72
68
// / that potential archetype.
@@ -274,10 +270,6 @@ class GenericSignatureBuilder {
274
270
GenericSignatureBuilder (const GenericSignatureBuilder &) = delete;
275
271
GenericSignatureBuilder &operator =(const GenericSignatureBuilder &) = delete ;
276
272
277
- // / Record that the given potential archetype is unresolved, so we know to
278
- // / resolve it later.
279
- void recordUnresolvedType (PotentialArchetype *unresolvedPA);
280
-
281
273
// / When a particular requirement cannot be resolved due to, e.g., a
282
274
// / currently-unresolvable or nested type, this routine should be
283
275
// / called to cope with the unresolved requirement.
@@ -315,10 +307,6 @@ class GenericSignatureBuilder {
315
307
ProtocolDecl *Proto,
316
308
const RequirementSource *Source);
317
309
318
- // / Try to resolve the given unresolved potential archetype.
319
- ConstraintResult resolveUnresolvedType (PotentialArchetype *pa,
320
- bool allowTypoCorrection);
321
-
322
310
public:
323
311
// / \brief Add a new same-type requirement between two fully resolved types
324
312
// / (output of \c GenericSignatureBuilder::resolve).
@@ -567,12 +555,6 @@ class GenericSignatureBuilder {
567
555
ArrayRef<GenericTypeParamType *> genericParams,
568
556
bool allowConcreteGenericParams=false );
569
557
570
- // / Diagnose any remaining renames.
571
- // /
572
- // / \returns \c true if there were any remaining renames to diagnose.
573
- bool diagnoseRemainingRenames (SourceLoc loc,
574
- ArrayRef<GenericTypeParamType *> genericParams);
575
-
576
558
// / Process any delayed requirements that can be handled now.
577
559
void processDelayedRequirements ();
578
560
@@ -1294,21 +1276,14 @@ class GenericSignatureBuilder::PotentialArchetype {
1294
1276
1295
1277
// / The identifier describing this particular archetype.
1296
1278
// /
1297
- // / \c parentOrBuilder determines whether we have a nested type vs. a root,
1298
- // / while `isUnresolvedNestedType` determines whether we have an unresolved
1299
- // / nested type (vs. a resolved one);
1279
+ // / \c parentOrBuilder determines whether we have a nested type vs. a root.
1300
1280
union PAIdentifier {
1301
- // / The name of an unresolved, nested type.
1302
- Identifier name;
1303
-
1304
1281
// / The associated type or typealias for a resolved nested type.
1305
1282
TypeDecl *assocTypeOrConcrete;
1306
1283
1307
1284
// / The generic parameter key for a root.
1308
1285
GenericParamKey genericParam;
1309
1286
1310
- PAIdentifier (Identifier name) : name (name) { }
1311
-
1312
1287
PAIdentifier (AssociatedTypeDecl *assocType)
1313
1288
: assocTypeOrConcrete (assocType) { }
1314
1289
@@ -1357,55 +1332,32 @@ class GenericSignatureBuilder::PotentialArchetype {
1357
1332
// / that share a name.
1358
1333
llvm::MapVector<Identifier, StoredNestedType> NestedTypes;
1359
1334
1360
- // / Tracks the number of conformances that
1361
- unsigned numConformancesInNestedType = 0 ;
1362
-
1363
- // / Whether this is an unresolved nested type.
1364
- unsigned isUnresolvedNestedType : 1 ;
1365
-
1366
1335
// / \brief Recursively conforms to itself.
1367
1336
unsigned IsRecursive : 1 ;
1368
1337
1369
- // / Whether this potential archetype is invalid, e.g., because it could not
1370
- // / be resolved.
1371
- unsigned Invalid : 1 ;
1372
-
1373
- // / Whether we have diagnosed a rename.
1374
- unsigned DiagnosedRename : 1 ;
1375
-
1376
- // / If we have renamed this (nested) type due to typo correction,
1377
- // / the old name.
1378
- Identifier OrigName;
1379
-
1380
1338
// / \brief Construct a new potential archetype for an unresolved
1381
1339
// / associated type.
1382
1340
PotentialArchetype (PotentialArchetype *parent, Identifier name);
1383
1341
1384
1342
// / \brief Construct a new potential archetype for an associated type.
1385
1343
PotentialArchetype (PotentialArchetype *parent, AssociatedTypeDecl *assocType)
1386
- : parentOrBuilder(parent), identifier(assocType),
1387
- isUnresolvedNestedType (false ), IsRecursive(false ), Invalid(false ),
1388
- DiagnosedRename(false )
1344
+ : parentOrBuilder(parent), identifier(assocType), IsRecursive(false )
1389
1345
{
1390
1346
assert (parent != nullptr && " Not an associated type?" );
1391
1347
}
1392
1348
1393
1349
// / \brief Construct a new potential archetype for a concrete declaration.
1394
1350
PotentialArchetype (PotentialArchetype *parent, TypeDecl *concreteDecl)
1395
- : parentOrBuilder(parent), identifier(concreteDecl),
1396
- isUnresolvedNestedType(false ),
1397
- IsRecursive(false ), Invalid(false ),
1398
- DiagnosedRename(false )
1351
+ : parentOrBuilder(parent), identifier(concreteDecl), IsRecursive(false )
1399
1352
{
1400
1353
assert (parent != nullptr && " Not an associated type?" );
1401
1354
}
1402
1355
1403
1356
// / \brief Construct a new potential archetype for a generic parameter.
1404
- PotentialArchetype (GenericSignatureBuilder *builder, GenericParamKey genericParam)
1357
+ PotentialArchetype (GenericSignatureBuilder *builder,
1358
+ GenericParamKey genericParam)
1405
1359
: parentOrBuilder(builder), identifier(genericParam),
1406
- isUnresolvedNestedType(false ),
1407
- IsRecursive(false ), Invalid(false ),
1408
- DiagnosedRename(false )
1360
+ IsRecursive (false )
1409
1361
{
1410
1362
}
1411
1363
@@ -1441,23 +1393,9 @@ class GenericSignatureBuilder::PotentialArchetype {
1441
1393
// / has been resolved.
1442
1394
AssociatedTypeDecl *getResolvedAssociatedType () const {
1443
1395
assert (getParent () && " Not an associated type" );
1444
- if (isUnresolvedNestedType)
1445
- return nullptr ;
1446
-
1447
1396
return dyn_cast<AssociatedTypeDecl>(identifier.assocTypeOrConcrete );
1448
1397
}
1449
1398
1450
- // / Determine whether this PA is still unresolved.
1451
- bool isUnresolved () const { return isUnresolvedNestedType; }
1452
-
1453
- // / Resolve the potential archetype to the given associated type.
1454
- void resolveAssociatedType (AssociatedTypeDecl *assocType,
1455
- GenericSignatureBuilder &builder);
1456
-
1457
- // / Resolve the potential archetype to the given typealias.
1458
- void resolveConcreteType (TypeDecl *concreteDecl,
1459
- GenericSignatureBuilder &builder);
1460
-
1461
1399
// / Determine whether this is a generic parameter.
1462
1400
bool isGenericParam () const {
1463
1401
return parentOrBuilder.is <GenericSignatureBuilder *>();
@@ -1484,18 +1422,12 @@ class GenericSignatureBuilder::PotentialArchetype {
1484
1422
// / Retrieve the name of a nested potential archetype.
1485
1423
Identifier getNestedName () const {
1486
1424
assert (getParent () && " Not a nested type" );
1487
- if (isUnresolvedNestedType)
1488
- return identifier.name ;
1489
-
1490
1425
return identifier.assocTypeOrConcrete ->getName ();
1491
1426
}
1492
1427
1493
1428
// / Retrieve the concrete type declaration.
1494
1429
TypeDecl *getConcreteTypeDecl () const {
1495
1430
assert (getParent () && " not a nested type" );
1496
- if (isUnresolvedNestedType)
1497
- return nullptr ;
1498
-
1499
1431
if (isa<AssociatedTypeDecl>(identifier.assocTypeOrConcrete ))
1500
1432
return nullptr ;
1501
1433
@@ -1649,12 +1581,7 @@ class GenericSignatureBuilder::PotentialArchetype {
1649
1581
// /
1650
1582
// / \param genericParams The set of generic parameters to use in the resulting
1651
1583
// / dependent type.
1652
- // /
1653
- // / \param allowUnresolved If true, allow the result to contain
1654
- // / \c DependentMemberType types with a name but no specific associated
1655
- // / type.
1656
- Type getDependentType (ArrayRef<GenericTypeParamType *> genericParams,
1657
- bool allowUnresolved);
1584
+ Type getDependentType (ArrayRef<GenericTypeParamType *> genericParams);
1658
1585
1659
1586
// / True if the potential archetype has been bound by a concrete type
1660
1587
// / constraint.
@@ -1676,32 +1603,6 @@ class GenericSignatureBuilder::PotentialArchetype {
1676
1603
void setIsRecursive () { IsRecursive = true ; }
1677
1604
bool isRecursive () const { return IsRecursive; }
1678
1605
1679
- bool isInvalid () const { return Invalid; }
1680
-
1681
- void setInvalid () { Invalid = true ; }
1682
-
1683
- // / Determine whether this archetype was renamed due to typo
1684
- // / correction. If so, \c getName() retrieves the new name.
1685
- bool wasRenamed () const { return !OrigName.empty (); }
1686
-
1687
- // / Note that this potential archetype was is going to be renamed (due to typo
1688
- // / correction), saving the old name.
1689
- void saveNameForRenaming () {
1690
- OrigName = getNestedName ();
1691
- }
1692
-
1693
- // / For a renamed potential archetype, retrieve the original name.
1694
- Identifier getOriginalName () const {
1695
- assert (wasRenamed ());
1696
- return OrigName;
1697
- }
1698
-
1699
- // / Whether we already diagnosed this rename.
1700
- bool alreadyDiagnosedRename () const { return DiagnosedRename; }
1701
-
1702
- // / Note that we already diagnosed this rename.
1703
- void setAlreadyDiagnosedRename () { DiagnosedRename = true ; }
1704
-
1705
1606
LLVM_ATTRIBUTE_DEPRECATED (
1706
1607
void dump () const ,
1707
1608
"only for use within the debugger");
@@ -1725,9 +1626,6 @@ class GenericSignatureBuilder::DelayedRequirement {
1725
1626
1726
1627
// / A same-type requirement.
1727
1628
SameType,
1728
-
1729
- // / An unresolved potential archetype.
1730
- Unresolved,
1731
1629
};
1732
1630
1733
1631
Kind kind;
0 commit comments