@@ -2343,14 +2343,13 @@ namespace {
2343
2343
2344
2344
// / Some function conversions synthesized by the constraint solver may not
2345
2345
// / 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>()) {
2351
2350
2352
2351
// ignore some kinds of casts, as they're diagnosed elsewhere.
2353
- if (toType ->hasGlobalActor () || toType ->isAsync ())
2352
+ if (toFnType ->hasGlobalActor () || toFnType ->isAsync ())
2354
2353
return ;
2355
2354
2356
2355
auto dc = const_cast <DeclContext*>(getDeclContext ());
@@ -2732,7 +2731,15 @@ namespace {
2732
2731
2733
2732
// The constraint solver may not have chosen legal casts.
2734
2733
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 ());
2736
2743
}
2737
2744
2738
2745
if (auto *defaultArg = dyn_cast<DefaultArgumentExpr>(expr)) {
0 commit comments