@@ -1107,6 +1107,9 @@ Type ConstraintSystem::getUnopenedTypeOfReference(
11071107 Type requestedType =
11081108 getType (value)->getWithoutSpecifierType ()->getReferenceStorageReferent ();
11091109
1110+ // Adjust the type for concurrency.
1111+ requestedType = adjustVarTypeForConcurrency (requestedType, value, UseDC);
1112+
11101113 // If we're dealing with contextual types, and we referenced this type from
11111114 // a different context, map the type.
11121115 if (!wantInterfaceType && requestedType->hasArchetype ()) {
@@ -1757,7 +1760,11 @@ ConstraintSystem::getTypeOfMemberReference(
17571760 ->castTo <AnyFunctionType>()->getParams ();
17581761 // FIXME: Verify ExtInfo state is correct, not working by accident.
17591762 FunctionType::ExtInfo info;
1760- refType = FunctionType::get (indices, elementTy, info);
1763+ auto *refFnType = FunctionType::get (indices, elementTy, info);
1764+
1765+ refType = adjustFunctionTypeForConcurrency (
1766+ refFnType, subscript, useDC, /* numApplies=*/ 1 ,
1767+ /* isMainDispatchQueue=*/ false );
17611768 } else {
17621769 refType = getUnopenedTypeOfReference (cast<VarDecl>(value), baseTy, useDC,
17631770 locator,
@@ -2051,14 +2058,17 @@ Type ConstraintSystem::getEffectiveOverloadType(ConstraintLocator *locator,
20512058 ->castTo <AnyFunctionType>()->getParams ();
20522059 // FIXME: Verify ExtInfo state is correct, not working by accident.
20532060 FunctionType::ExtInfo info;
2054- type = FunctionType::get (indices, elementTy, info);
2061+ type = adjustFunctionTypeForConcurrency (
2062+ FunctionType::get (indices, elementTy, info),
2063+ subscript, useDC, /* numApplies=*/ 1 , /* isMainDispatchQueue=*/ false );
20552064 } else if (auto var = dyn_cast<VarDecl>(decl)) {
20562065 type = var->getValueInterfaceType ();
20572066 if (doesStorageProduceLValue (var, overload.getBaseType (), useDC)) {
20582067 type = LValueType::get (type);
20592068 } else if (type->hasDynamicSelfType ()) {
20602069 type = withDynamicSelfResultReplaced (type, /* uncurryLevel=*/ 0 );
20612070 }
2071+ type = adjustVarTypeForConcurrency (type, var, useDC);
20622072 } else if (isa<AbstractFunctionDecl>(decl) || isa<EnumElementDecl>(decl)) {
20632073 if (decl->isInstanceMember () &&
20642074 (!overload.getBaseType () ||
@@ -2087,7 +2097,10 @@ Type ConstraintSystem::getEffectiveOverloadType(ConstraintLocator *locator,
20872097 }
20882098 }
20892099
2090- type = type->castTo <FunctionType>()->getResult ();
2100+ type = adjustFunctionTypeForConcurrency (
2101+ type->castTo <FunctionType>(),
2102+ subscript, useDC, /* numApplies=*/ 2 , /* isMainDispatchQueue=*/ false )
2103+ ->getResult ();
20912104 }
20922105 }
20932106
0 commit comments