Skip to content

Commit 45ec809

Browse files
committed
Sema: Clean up property wrapper application in getTypeOfMemberReference()
If there are no property wrappers to unwrap, we don't need to take the FunctionType apart and put it back together again.
1 parent 6dc2e75 commit 45ec809

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

lib/Sema/TypeOfReference.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,23 +1900,17 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
19001900
}
19011901

19021902
if (auto *funcDecl = dyn_cast<AbstractFunctionDecl>(value)) {
1903-
auto *fullFunctionType = openedType->getAs<AnyFunctionType>();
1903+
if (functionRefInfo.isUnapplied()) {
1904+
auto *fullFunctionType = openedType->getAs<AnyFunctionType>();
19041905

1905-
// Strip off the 'self' parameter
1906-
auto *functionType = fullFunctionType->getResult()->getAs<FunctionType>();
1907-
functionType = unwrapPropertyWrapperParameterTypes(
1908-
*this, funcDecl, functionRefInfo, functionType,
1909-
locator, preparedOverload);
1910-
// FIXME: Verify ExtInfo state is correct, not working by accident.
1911-
FunctionType::ExtInfo info;
1912-
1913-
// We'll do other adjustment later, but we need to handle parameter
1914-
// isolation to avoid assertions.
1915-
if (fullFunctionType->getIsolation().isParameter())
1916-
info = info.withIsolation(FunctionTypeIsolation::forParameter());
1917-
1918-
openedType =
1919-
FunctionType::get(fullFunctionType->getParams(), functionType, info);
1906+
auto *functionType = fullFunctionType->getResult()->getAs<FunctionType>();
1907+
functionType = unwrapPropertyWrapperParameterTypes(
1908+
*this, funcDecl, functionRefInfo, functionType,
1909+
locator, preparedOverload);
1910+
openedType =
1911+
FunctionType::get(fullFunctionType->getParams(), functionType,
1912+
fullFunctionType->getExtInfo());
1913+
}
19201914
}
19211915

19221916
// Adjust the opened type for concurrency.

0 commit comments

Comments
 (0)