@@ -2343,14 +2343,13 @@ namespace {
23432343
23442344 // / Some function conversions synthesized by the constraint solver may not
23452345 // / be correct AND the solver doesn't know, so we must emit a diagnostic.
2346- void checkFunctionConversion (FunctionConversionExpr *funcConv) {
2347- auto subExprType = funcConv->getSubExpr ()->getType ();
2348- if (auto fromType = subExprType->getAs <FunctionType>()) {
2349- if (auto fromActor = fromType->getGlobalActor ()) {
2350- if (auto toType = funcConv->getType ()->getAs <FunctionType>()) {
2346+ void checkFunctionConversion (Expr *funcConv, Type fromType, Type toType) {
2347+ if (auto fromFnType = fromType->getAs <FunctionType>()) {
2348+ if (auto fromActor = fromFnType->getGlobalActor ()) {
2349+ if (auto toFnType = toType->getAs <FunctionType>()) {
23512350
23522351 // ignore some kinds of casts, as they're diagnosed elsewhere.
2353- if (toType ->hasGlobalActor () || toType ->isAsync ())
2352+ if (toFnType ->hasGlobalActor () || toFnType ->isAsync ())
23542353 return ;
23552354
23562355 auto dc = const_cast <DeclContext*>(getDeclContext ());
@@ -2732,7 +2731,15 @@ namespace {
27322731
27332732 // The constraint solver may not have chosen legal casts.
27342733 if (auto funcConv = dyn_cast<FunctionConversionExpr>(expr)) {
2735- checkFunctionConversion (funcConv);
2734+ checkFunctionConversion (funcConv,
2735+ funcConv->getSubExpr ()->getType (),
2736+ funcConv->getType ());
2737+ }
2738+
2739+ if (auto *isolationErasure = dyn_cast<ActorIsolationErasureExpr>(expr)) {
2740+ checkFunctionConversion (isolationErasure,
2741+ isolationErasure->getSubExpr ()->getType (),
2742+ isolationErasure->getType ());
27362743 }
27372744
27382745 if (auto *defaultArg = dyn_cast<DefaultArgumentExpr>(expr)) {
0 commit comments