@@ -489,14 +489,22 @@ static Optional<PartialApplyThunkInfo> decomposePartialApplyThunk(
489489
490490// / Find the immediate member reference in the given expression.
491491static Optional<std::pair<ConcreteDeclRef, SourceLoc>>
492- findMemberReference (Expr *expr) {
492+ findReference (Expr *expr) {
493+ // Look through a function conversion.
494+ if (auto fnConv = dyn_cast<FunctionConversionExpr>(expr))
495+ expr = fnConv->getSubExpr ();
496+
493497 if (auto declRef = dyn_cast<DeclRefExpr>(expr))
494498 return std::make_pair (declRef->getDeclRef (), declRef->getLoc ());
495499
496500 if (auto otherCtor = dyn_cast<OtherConstructorDeclRefExpr>(expr)) {
497501 return std::make_pair (otherCtor->getDeclRef (), otherCtor->getLoc ());
498502 }
499503
504+ Expr *inner = expr->getValueProvidingExpr ();
505+ if (inner != expr)
506+ return findReference (inner);
507+
500508 return None;
501509}
502510
@@ -1878,7 +1886,7 @@ namespace {
18781886 // like based on the original written syntax, e.g., "self.method".
18791887 if (auto partialApply = decomposePartialApplyThunk (
18801888 apply, Parent.getAsExpr ())) {
1881- if (auto memberRef = findMemberReference (partialApply->fn )) {
1889+ if (auto memberRef = findReference (partialApply->fn )) {
18821890 // NOTE: partially-applied thunks are never annotated as
18831891 // implicitly async, regardless of whether they are escaping.
18841892 checkReference (
@@ -1899,7 +1907,7 @@ namespace {
18991907 // NOTE: SelfApplyExpr is a subtype of ApplyExpr
19001908 if (auto call = dyn_cast<SelfApplyExpr>(expr)) {
19011909 Expr *fn = call->getFn ()->getValueProvidingExpr ();
1902- if (auto memberRef = findMemberReference (fn)) {
1910+ if (auto memberRef = findReference (fn)) {
19031911 checkReference (
19041912 call->getBase (), memberRef->first , memberRef->second ,
19051913 /* partialApply=*/ None, call);
@@ -2134,6 +2142,8 @@ namespace {
21342142
21352143 if (auto conversion = dyn_cast<ImplicitConversionExpr>(expr))
21362144 expr = conversion->getSubExpr ();
2145+ if (auto fnConv = dyn_cast<FunctionConversionExpr>(expr))
2146+ expr = fnConv->getSubExpr ();
21372147 } while (prior != expr);
21382148
21392149 if (auto call = dyn_cast<DotSyntaxCallExpr>(expr)) {
@@ -2410,7 +2420,9 @@ namespace {
24102420 // and the fact that the reference may be just an argument to an apply
24112421 ApplyExpr *apply = applyStack.back ();
24122422 Expr *fn = apply->getFn ()->getValueProvidingExpr ();
2413- if (auto memberRef = findMemberReference (fn)) {
2423+ if (auto fnConv = dyn_cast<FunctionConversionExpr>(fn))
2424+ fn = fnConv->getSubExpr ()->getValueProvidingExpr ();
2425+ if (auto memberRef = findReference (fn)) {
24142426 auto concDecl = memberRef->first ;
24152427 if (decl == concDecl.getDecl () && !apply->isImplicitlyAsync ()) {
24162428
@@ -2528,7 +2540,8 @@ namespace {
25282540
25292541 // If we are not in an asynchronous context, complain.
25302542 if (!getDeclContext ()->isAsyncContext ()) {
2531- if (auto calleeDecl = apply->getCalledValue ()) {
2543+ if (auto calleeDecl = apply->getCalledValue (
2544+ /* skipFunctionConversions=*/ true )) {
25322545 ctx.Diags .diagnose (
25332546 apply->getLoc (), diag::actor_isolated_call_decl,
25342547 *unsatisfiedIsolation,
0 commit comments