@@ -651,8 +651,7 @@ ClosureIsolatedByPreconcurrency::operator()(const ClosureExpr *expr) const {
651651
652652Type ConstraintSystem::getUnopenedTypeOfReference (
653653 VarDecl *value, Type baseType, DeclContext *UseDC,
654- ConstraintLocator *locator, bool wantInterfaceType,
655- bool adjustForPreconcurrency) {
654+ ConstraintLocator *locator, bool wantInterfaceType) {
656655 Type requestedType;
657656 if (Type type = getTypeIfAvailable (value)) {
658657 requestedType = type;
@@ -671,14 +670,6 @@ Type ConstraintSystem::getUnopenedTypeOfReference(
671670 if (auto *expansion = requestedType->getAs <PackExpansionType>())
672671 requestedType = expansion->getPatternType ();
673672
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-
682673 // If we're dealing with contextual types, and we referenced this type from
683674 // a different context, map the type.
684675 if (!wantInterfaceType && requestedType->hasArchetype ()) {
@@ -1057,15 +1048,6 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
10571048 *this , funcDecl, functionRefInfo, openedType->castTo <FunctionType>(),
10581049 locator, preparedOverload);
10591050
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-
10691051 if (isForCodeCompletion () && openedType->hasError ()) {
10701052 // In code completion, replace error types by placeholder types so we can
10711053 // match the types we know instead of bailing out completely.
@@ -1076,6 +1058,15 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
10761058 // If we opened up any type variables, record the replacements.
10771059 recordOpenedTypes (locator, replacements, preparedOverload);
10781060
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+
10791070 return { origOpenedType, openedType, origOpenedType, openedType, Type () };
10801071 }
10811072
@@ -1128,12 +1119,16 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
11281119 auto *varDecl = cast<VarDecl>(value);
11291120
11301121 // Determine the type of the value, opening up that type if necessary.
1131- // FIXME: @preconcurrency
11321122 bool wantInterfaceType = !varDecl->getDeclContext ()->isLocalContext ();
11331123 Type valueType =
11341124 getUnopenedTypeOfReference (varDecl, Type (), useDC,
11351125 getConstraintLocator (locator),
11361126 wantInterfaceType);
1127+ // FIXME: Adjust the type for concurrency if requested.
1128+ valueType = adjustVarTypeForConcurrency (
1129+ valueType, varDecl, useDC,
1130+ GetClosureType{*this },
1131+ ClosureIsolatedByPreconcurrency{*this });
11371132
11381133 Type thrownErrorType;
11391134 if (auto accessor = varDecl->getEffectfulGetAccessor ()) {
@@ -1724,8 +1719,7 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
17241719
17251720 refType = getUnopenedTypeOfReference (cast<VarDecl>(value), baseTy, useDC,
17261721 locator,
1727- /* wantInterfaceType=*/ true ,
1728- /* adjustForPreconcurrency=*/ false );
1722+ /* wantInterfaceType=*/ true );
17291723 }
17301724
17311725 auto selfTy = outerDC->getSelfInterfaceType ();
0 commit comments