@@ -651,8 +651,7 @@ ClosureIsolatedByPreconcurrency::operator()(const ClosureExpr *expr) const {
651
651
652
652
Type ConstraintSystem::getUnopenedTypeOfReference (
653
653
VarDecl *value, Type baseType, DeclContext *UseDC,
654
- ConstraintLocator *locator, bool wantInterfaceType,
655
- bool adjustForPreconcurrency) {
654
+ ConstraintLocator *locator, bool wantInterfaceType) {
656
655
Type requestedType;
657
656
if (Type type = getTypeIfAvailable (value)) {
658
657
requestedType = type;
@@ -671,14 +670,6 @@ Type ConstraintSystem::getUnopenedTypeOfReference(
671
670
if (auto *expansion = requestedType->getAs <PackExpansionType>())
672
671
requestedType = expansion->getPatternType ();
673
672
674
- // Adjust the type for concurrency if requested.
675
- if (adjustForPreconcurrency) {
676
- requestedType = adjustVarTypeForConcurrency (
677
- requestedType, value, UseDC,
678
- GetClosureType{*this },
679
- ClosureIsolatedByPreconcurrency{*this });
680
- }
681
-
682
673
// If we're dealing with contextual types, and we referenced this type from
683
674
// a different context, map the type.
684
675
if (!wantInterfaceType && requestedType->hasArchetype ()) {
@@ -1057,15 +1048,6 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
1057
1048
*this , funcDecl, functionRefInfo, openedType->castTo <FunctionType>(),
1058
1049
locator, preparedOverload);
1059
1050
1060
- auto origOpenedType = openedType;
1061
- if (!isRequirementOrWitness (locator)) {
1062
- unsigned numApplies = getNumApplications (/* hasAppliedSelf*/ false ,
1063
- functionRefInfo);
1064
- openedType = adjustFunctionTypeForConcurrency (
1065
- origOpenedType->castTo <FunctionType>(), /* baseType=*/ Type (), funcDecl,
1066
- useDC, numApplies, false , replacements, locator, preparedOverload);
1067
- }
1068
-
1069
1051
if (isForCodeCompletion () && openedType->hasError ()) {
1070
1052
// In code completion, replace error types by placeholder types so we can
1071
1053
// match the types we know instead of bailing out completely.
@@ -1076,6 +1058,15 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
1076
1058
// If we opened up any type variables, record the replacements.
1077
1059
recordOpenedTypes (locator, replacements, preparedOverload);
1078
1060
1061
+ auto origOpenedType = openedType;
1062
+ if (!isRequirementOrWitness (locator)) {
1063
+ unsigned numApplies = getNumApplications (/* hasAppliedSelf*/ false ,
1064
+ functionRefInfo);
1065
+ openedType = adjustFunctionTypeForConcurrency (
1066
+ origOpenedType->castTo <FunctionType>(), /* baseType=*/ Type (), funcDecl,
1067
+ useDC, numApplies, false , replacements, locator, preparedOverload);
1068
+ }
1069
+
1079
1070
return { origOpenedType, openedType, origOpenedType, openedType, Type () };
1080
1071
}
1081
1072
@@ -1128,12 +1119,16 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
1128
1119
auto *varDecl = cast<VarDecl>(value);
1129
1120
1130
1121
// Determine the type of the value, opening up that type if necessary.
1131
- // FIXME: @preconcurrency
1132
1122
bool wantInterfaceType = !varDecl->getDeclContext ()->isLocalContext ();
1133
1123
Type valueType =
1134
1124
getUnopenedTypeOfReference (varDecl, Type (), useDC,
1135
1125
getConstraintLocator (locator),
1136
1126
wantInterfaceType);
1127
+ // FIXME: Adjust the type for concurrency if requested.
1128
+ valueType = adjustVarTypeForConcurrency (
1129
+ valueType, varDecl, useDC,
1130
+ GetClosureType{*this },
1131
+ ClosureIsolatedByPreconcurrency{*this });
1137
1132
1138
1133
Type thrownErrorType;
1139
1134
if (auto accessor = varDecl->getEffectfulGetAccessor ()) {
@@ -1724,8 +1719,7 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
1724
1719
1725
1720
refType = getUnopenedTypeOfReference (cast<VarDecl>(value), baseTy, useDC,
1726
1721
locator,
1727
- /* wantInterfaceType=*/ true ,
1728
- /* adjustForPreconcurrency=*/ false );
1722
+ /* wantInterfaceType=*/ true );
1729
1723
}
1730
1724
1731
1725
auto selfTy = outerDC->getSelfInterfaceType ();
0 commit comments