@@ -2214,7 +2214,7 @@ isInvalidPartialApplication(ConstraintSystem &cs,
2214
2214
// / the full opened type and the reference's type.
2215
2215
static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics (
2216
2216
ConstraintSystem &CS, ConstraintLocator *locator,
2217
- DeclTypeCheckingSemantics semantics) {
2217
+ DeclTypeCheckingSemantics semantics, DeclContext *useDC ) {
2218
2218
switch (semantics) {
2219
2219
case DeclTypeCheckingSemantics::Normal:
2220
2220
llvm_unreachable (" Decl does not have special type checking semantics!" );
@@ -2261,10 +2261,11 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
2261
2261
CS.getConstraintLocator (locator, ConstraintLocator::ThrownErrorType),
2262
2262
0 );
2263
2263
FunctionType::Param arg (escapeClosure);
2264
+ bool isAsync = CS.isAsynchronousContext (useDC);
2264
2265
auto bodyClosure = FunctionType::get (arg, result,
2265
2266
FunctionType::ExtInfoBuilder ()
2266
2267
.withNoEscape (true )
2267
- .withAsync (true )
2268
+ .withAsync (isAsync )
2268
2269
.withThrows (true , thrownError)
2269
2270
.build ());
2270
2271
FunctionType::Param args[] = {
@@ -2275,7 +2276,7 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
2275
2276
auto refType = FunctionType::get (args, result,
2276
2277
FunctionType::ExtInfoBuilder ()
2277
2278
.withNoEscape (false )
2278
- .withAsync (true )
2279
+ .withAsync (isAsync )
2279
2280
.withThrows (true , thrownError)
2280
2281
.build ());
2281
2282
return {refType, refType, refType, refType, Type ()};
@@ -2370,7 +2371,7 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
2370
2371
DeclReferenceType declRefType;
2371
2372
if (semantics != DeclTypeCheckingSemantics::Normal) {
2372
2373
declRefType = getTypeOfReferenceWithSpecialTypeCheckingSemantics (
2373
- *this , locator, semantics);
2374
+ *this , locator, semantics, useDC );
2374
2375
} else if (auto baseTy = choice.getBaseType ()) {
2375
2376
// Retrieve the type of a reference to the specific declaration choice.
2376
2377
assert (!baseTy->hasTypeParameter ());
0 commit comments