Skip to content

Commit 906e9cb

Browse files
committed
Sema: Remove unnecessary getFixedTypeRecursive() call in getTypeOfMemberReference()
1 parent 44bd5be commit 906e9cb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/Sema/TypeOfReference.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,19 +1594,19 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
15941594
ASSERT(!!preparedOverload == PreparingOverload);
15951595

15961596
// Figure out the instance type used for the base.
1597-
Type resolvedBaseTy = getFixedTypeRecursive(baseTy, /*wantRValue=*/true);
1597+
Type baseRValueTy = baseTy->getRValueType();
15981598

15991599
// If the base is a module type, just use the type of the decl.
1600-
if (resolvedBaseTy->is<ModuleType>()) {
1600+
if (baseRValueTy->is<ModuleType>()) {
16011601
return getTypeOfReference(value, functionRefInfo, locator, useDC,
16021602
preparedOverload);
16031603
}
16041604

16051605
// Check to see if the self parameter is applied, in which case we'll want to
16061606
// strip it off later.
1607-
auto hasAppliedSelf = doesMemberRefApplyCurriedSelf(resolvedBaseTy, value);
1607+
auto hasAppliedSelf = doesMemberRefApplyCurriedSelf(baseRValueTy, value);
16081608

1609-
auto baseObjTy = resolvedBaseTy->getMetatypeInstanceType();
1609+
auto baseObjTy = baseRValueTy->getMetatypeInstanceType();
16101610
FunctionType::Param baseObjParam(baseObjTy);
16111611

16121612
// Indicates whether this is a valid reference to a static member on a
@@ -1617,7 +1617,7 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
16171617
bool isStaticMemberRefOnProtocol = false;
16181618
if (baseObjTy->isExistentialType() && value->isStatic() &&
16191619
locator->isLastElement<LocatorPathElt::UnresolvedMember>()) {
1620-
assert(resolvedBaseTy->is<MetatypeType>() &&
1620+
assert(baseRValueTy->is<MetatypeType>() &&
16211621
"Assumed base of unresolved member access must be a metatype");
16221622
isStaticMemberRefOnProtocol = true;
16231623
}
@@ -1846,12 +1846,12 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
18461846
} else if (isa<AbstractFunctionDecl>(value) || isa<EnumElementDecl>(value)) {
18471847
unsigned numApplies = getNumApplications(hasAppliedSelf, functionRefInfo);
18481848
openedType = adjustFunctionTypeForConcurrency(
1849-
origOpenedType->castTo<FunctionType>(), resolvedBaseTy, value, useDC,
1849+
origOpenedType->castTo<FunctionType>(), baseRValueTy, value, useDC,
18501850
numApplies, isMainDispatchQueueMember(locator), replacements, locator,
18511851
preparedOverload);
18521852
} else if (auto subscript = dyn_cast<SubscriptDecl>(value)) {
18531853
openedType = adjustFunctionTypeForConcurrency(
1854-
origOpenedType->castTo<FunctionType>(), resolvedBaseTy, subscript, useDC,
1854+
origOpenedType->castTo<FunctionType>(), baseRValueTy, subscript, useDC,
18551855
/*numApplies=*/2, /*isMainDispatchQueue=*/false, replacements, locator,
18561856
preparedOverload);
18571857
} else if (auto var = dyn_cast<VarDecl>(value)) {

0 commit comments

Comments
 (0)