@@ -488,21 +488,25 @@ bool GenericSignature::requiresClass(Type type, ModuleDecl &mod) {
488
488
builder.resolveArchetype (type, ArchetypeResolutionKind::CompleteWellFormed);
489
489
if (!pa) return false ;
490
490
491
- pa = pa->getRepresentative () ;
491
+ if ( pa->isConcreteType ()) return false ;
492
492
493
493
// If this type was mapped to a concrete type, then there is no
494
494
// requirement.
495
+ pa = pa->getRepresentative ();
496
+
495
497
if (pa->isConcreteType ()) return false ;
496
498
497
499
// If there is a layout constraint, it might be a class.
498
- if (auto layout = pa->getLayout ())
499
- if (layout->isClass ())
500
- return true ;
500
+ if (auto layout = pa->getLayout ()) {
501
+ if (layout->isClass ()) return true ;
502
+ }
501
503
502
504
// If there is a superclass bound, then obviously it must be a class.
505
+ // FIXME: We shouldn't need this?
503
506
if (pa->getSuperclass ()) return true ;
504
507
505
508
// If any of the protocols are class-bound, then it must be a class.
509
+ // FIXME: We shouldn't need this?
506
510
for (auto proto : pa->getConformsTo ()) {
507
511
if (proto->requiresClass ()) return true ;
508
512
}
@@ -519,8 +523,6 @@ Type GenericSignature::getSuperclassBound(Type type, ModuleDecl &mod) {
519
523
builder.resolveArchetype (type, ArchetypeResolutionKind::CompleteWellFormed);
520
524
if (!pa) return nullptr ;
521
525
522
- pa = pa->getRepresentative ();
523
-
524
526
// If this type was mapped to a concrete type, then there is no
525
527
// requirement.
526
528
if (pa->isConcreteType ()) return nullptr ;
@@ -540,8 +542,6 @@ SmallVector<ProtocolDecl *, 2> GenericSignature::getConformsTo(Type type,
540
542
builder.resolveArchetype (type, ArchetypeResolutionKind::CompleteWellFormed);
541
543
if (!pa) return { };
542
544
543
- pa = pa->getRepresentative ();
544
-
545
545
// If this type was mapped to a concrete type, then there are no
546
546
// requirements.
547
547
if (pa->isConcreteType ()) return { };
@@ -567,8 +567,6 @@ bool GenericSignature::conformsToProtocol(Type type, ProtocolDecl *proto,
567
567
builder.resolveArchetype (type, ArchetypeResolutionKind::CompleteWellFormed);
568
568
if (!pa) return false ;
569
569
570
- pa = pa->getRepresentative ();
571
-
572
570
// FIXME: Deal with concrete conformances here?
573
571
if (pa->isConcreteType ()) return false ;
574
572
@@ -596,9 +594,6 @@ Type GenericSignature::getConcreteType(Type type, ModuleDecl &mod) {
596
594
builder.resolveArchetype (type, ArchetypeResolutionKind::CompleteWellFormed);
597
595
if (!pa) return Type ();
598
596
599
- pa = pa->getRepresentative ();
600
- if (!pa->isConcreteType ()) return Type ();
601
-
602
597
return pa->getConcreteType ();
603
598
}
604
599
@@ -611,7 +606,6 @@ LayoutConstraint GenericSignature::getLayoutConstraint(Type type,
611
606
builder.resolveArchetype (type, ArchetypeResolutionKind::CompleteWellFormed);
612
607
if (!pa) return LayoutConstraint ();
613
608
614
- pa = pa->getRepresentative ();
615
609
return pa->getLayout ();
616
610
}
617
611
@@ -882,7 +876,7 @@ ConformanceAccessPath GenericSignature::getConformanceAccessPath(
882
876
auto pa =
883
877
inProtoSigBuilder.resolveArchetype (
884
878
storedType,
885
- ArchetypeResolutionKind::WellFormed );
879
+ ArchetypeResolutionKind::CompleteWellFormed );
886
880
auto equivClass = pa->getOrCreateEquivalenceClass ();
887
881
888
882
// Find the conformance of this potential archetype to the protocol in
0 commit comments