@@ -334,9 +334,10 @@ class alignas(8) Expr {
334334 NumCaptures : 32
335335 );
336336
337- SWIFT_INLINE_BITFIELD (ApplyExpr, Expr, 1 +1 ,
337+ SWIFT_INLINE_BITFIELD (ApplyExpr, Expr, 1 +1 + 1 ,
338338 ThrowsIsSet : 1 ,
339- Throws : 1
339+ Throws : 1 ,
340+ ImplicitlyAsync : 1
340341 );
341342
342343 SWIFT_INLINE_BITFIELD_FULL (CallExpr, ApplyExpr, 1 +1 +16 ,
@@ -4308,6 +4309,7 @@ class ApplyExpr : public Expr {
43084309 assert (classof ((Expr*)this ) && " ApplyExpr::classof out of date" );
43094310 assert (validateArg (Arg) && " Arg is not a permitted expr kind" );
43104311 Bits.ApplyExpr .ThrowsIsSet = false ;
4312+ Bits.ApplyExpr .ImplicitlyAsync = false ;
43114313 }
43124314
43134315public:
@@ -4346,6 +4348,29 @@ class ApplyExpr : public Expr {
43464348 Bits.ApplyExpr .Throws = throws;
43474349 }
43484350
4351+ // / Is this application _implicitly_ required to be an async call?
4352+ // / Note that this is _not_ a check for whether the callee is async!
4353+ // / Only meaningful after complete type-checking.
4354+ // /
4355+ // / Generally, this comes up only when we have a non-self call to an actor
4356+ // / instance's synchronous method. Such calls are conceptually treated as if
4357+ // / they are wrapped with an async closure. For example,
4358+ // /
4359+ // / act.syncMethod(a, b)
4360+ // /
4361+ // / is equivalent to the eta-expanded version of act.syncMethod,
4362+ // /
4363+ // / { (a1, b1) async in act.syncMethod(a1, b1) }(a, b)
4364+ // /
4365+ // / where the new closure is declared to be async.
4366+ // /
4367+ bool implicitlyAsync () const {
4368+ return Bits.ApplyExpr .ImplicitlyAsync ;
4369+ }
4370+ void setImplicitlyAsync (bool flag) {
4371+ Bits.ApplyExpr .ImplicitlyAsync = flag;
4372+ }
4373+
43494374 ValueDecl *getCalledValue () const ;
43504375
43514376 // / Retrieve the argument labels provided at the call site.
0 commit comments