@@ -494,6 +494,8 @@ class TypeSubstituter : public TypeTransform<TypeSubstituter> {
494
494
495
495
Type transformPackElement (PackElementType *element, TypePosition pos);
496
496
497
+ Type transformDependentMember (DependentMemberType *dependent, TypePosition pos);
498
+
497
499
SubstitutionMap transformSubstitutionMap (SubstitutionMap subs);
498
500
499
501
CanType transformSILField (CanType fieldTy, TypePosition pos);
@@ -510,19 +512,6 @@ TypeSubstituter::transform(TypeBase *type, TypePosition position) {
510
512
" should not be doing AST type-substitution on a lowered SIL type;"
511
513
" use SILType::subst" );
512
514
513
- // We only substitute for substitutable types and dependent member types.
514
-
515
- // For dependent member types, we may need to look up the member if the
516
- // base is resolved to a non-dependent type.
517
- if (auto depMemTy = dyn_cast<DependentMemberType>(type)) {
518
- auto newBase = doIt (depMemTy->getBase (), TypePosition::Invariant);
519
- return getMemberForBaseType (IFS,
520
- depMemTy->getBase (), newBase,
521
- depMemTy->getAssocType (),
522
- depMemTy->getName (),
523
- level);
524
- }
525
-
526
515
auto substOrig = dyn_cast<SubstitutableType>(type);
527
516
if (!substOrig)
528
517
return std::nullopt;
@@ -593,6 +582,16 @@ Type TypeSubstituter::transformPackElement(PackElementType *element,
593
582
return doIt (element->getPackType (), pos);
594
583
}
595
584
585
+ Type TypeSubstituter::transformDependentMember (DependentMemberType *dependent,
586
+ TypePosition pos) {
587
+ auto newBase = doIt (dependent->getBase (), TypePosition::Invariant);
588
+ return getMemberForBaseType (IFS,
589
+ dependent->getBase (), newBase,
590
+ dependent->getAssocType (),
591
+ dependent->getName (),
592
+ level);
593
+ }
594
+
596
595
SubstitutionMap TypeSubstituter::transformSubstitutionMap (SubstitutionMap subs) {
597
596
// FIXME: Take level into account? Move level down into IFS?
598
597
return subs.subst (IFS);
0 commit comments