Skip to content

Commit d8ce7c3

Browse files
committed
Sema: Tweak VarDecl concurrency adjustment in getTypeOfReference() to look like FuncDecl case
1 parent c8b281c commit d8ce7c3

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

lib/Sema/TypeOfReference.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,21 +1257,27 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
12571257
getUnopenedTypeOfReference(varDecl, Type(), useDC,
12581258
getConstraintLocator(locator),
12591259
wantInterfaceType);
1260-
// FIXME: Adjust the type for concurrency if requested.
1261-
valueType = adjustVarTypeForConcurrency(
1262-
valueType, varDecl, useDC,
1263-
GetClosureType{*this},
1264-
ClosureIsolatedByPreconcurrency{*this});
1260+
1261+
ASSERT(!valueType->hasUnboundGenericType() &&
1262+
!valueType->hasTypeParameter());
12651263

12661264
Type thrownErrorType;
12671265
if (auto accessor = varDecl->getEffectfulGetAccessor()) {
12681266
thrownErrorType =
12691267
accessor->getEffectiveThrownErrorType().value_or(Type());
12701268
}
12711269

1272-
assert(!valueType->hasUnboundGenericType() &&
1273-
!valueType->hasTypeParameter());
1274-
return { valueType, valueType, valueType, valueType, thrownErrorType };
1270+
// Adjust the type for concurrency.
1271+
auto origValueType = valueType;
1272+
1273+
if (!isRequirementOrWitness(locator)) {
1274+
valueType = adjustVarTypeForConcurrency(
1275+
valueType, varDecl, useDC,
1276+
GetClosureType{*this},
1277+
ClosureIsolatedByPreconcurrency{*this});
1278+
}
1279+
1280+
return { origValueType, valueType, origValueType, valueType, thrownErrorType };
12751281
}
12761282

12771283
/// Bind type variables for archetypes that are determined from

0 commit comments

Comments
 (0)