@@ -337,7 +337,7 @@ Type TypeChecker::resolveTypeInContext(
337337 }
338338
339339 return substMemberTypeWithBase (parentDC->getParentModule (), typeDecl,
340- fromType, /* isTypeReference= */ true );
340+ fromType);
341341 }
342342 }
343343
@@ -378,7 +378,7 @@ Type TypeChecker::resolveTypeInContext(
378378 }
379379
380380 return substMemberTypeWithBase (parentDC->getParentModule (), typeDecl,
381- fromType, /* isTypeReference= */ true );
381+ fromType);
382382 }
383383
384384 if (auto superclassTy = getSuperClassOf (fromType))
@@ -1142,8 +1142,7 @@ static Type resolveNestedIdentTypeComponent(
11421142
11431143 // Otherwise, simply substitute the parent type into the member.
11441144 memberType = TC.substMemberTypeWithBase (DC->getParentModule (), typeDecl,
1145- parentTy,
1146- /* isTypeReference=*/ true );
1145+ parentTy);
11471146
11481147 // Propagate failure.
11491148 if (!memberType || memberType->hasError ()) return memberType;
@@ -2797,21 +2796,18 @@ Type TypeResolver::buildProtocolType(
27972796}
27982797
27992798Type TypeChecker::substMemberTypeWithBase (Module *module ,
2800- const ValueDecl *member,
2801- Type baseTy, bool isTypeReference) {
2802- Type memberType = isTypeReference
2803- ? cast<TypeDecl>(member)->getDeclaredInterfaceType ()
2804- : member->getInterfaceType ();
2805- if (isTypeReference) {
2806- // The declared interface type for a generic type will have the type
2807- // arguments; strip them off.
2808- if (auto nominalTypeDecl = dyn_cast<NominalTypeDecl>(member)) {
2809- if (auto boundGenericTy = memberType->getAs <BoundGenericType>()) {
2810- memberType = UnboundGenericType::get (
2811- const_cast <NominalTypeDecl *>(nominalTypeDecl),
2812- boundGenericTy->getParent (),
2813- Context);
2814- }
2799+ const TypeDecl *member,
2800+ Type baseTy) {
2801+ Type memberType = member->getDeclaredInterfaceType ();
2802+
2803+ // The declared interface type for a generic type will have the type
2804+ // arguments; strip them off.
2805+ if (auto nominalTypeDecl = dyn_cast<NominalTypeDecl>(member)) {
2806+ if (auto boundGenericTy = memberType->getAs <BoundGenericType>()) {
2807+ memberType = UnboundGenericType::get (
2808+ const_cast <NominalTypeDecl *>(nominalTypeDecl),
2809+ boundGenericTy->getParent (),
2810+ Context);
28152811 }
28162812 }
28172813
0 commit comments