File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -4672,7 +4672,8 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
46724672 .highlight (E->getAwaitLoc ());
46734673 return ;
46744674 }
4675- Ctx.Diags .diagnose (E->getAwaitLoc (), diag::no_async_in_await);
4675+ Ctx.Diags .diagnose (E->getAwaitLoc (), diag::no_async_in_await)
4676+ .fixItRemove (E->getAwaitLoc ());
46764677 }
46774678
46784679 void diagnoseRedundantUnsafe (UnsafeExpr *E) const {
Original file line number Diff line number Diff line change 1- // RUN: %target-swift-frontend - typecheck -verify %s -disable-availability-checking
1+ // RUN: %target-typecheck-verify-swift -disable-availability-checking
22
33// REQUIRES: concurrency
44
@@ -239,3 +239,28 @@ func testAsyncExprWithoutAwait() async {
239239 // expected-warning@-1 {{initialization of immutable value 'a' was never used; consider replacing with assignment to '_' or removing it}}
240240 // expected-note@-2 {{call is 'async'}}
241241}
242+
243+ // https://github.com/swiftlang/swift/issues/85818
244+ func testNoAsyncInAwait( ) async {
245+ func g( ) { }
246+ await g ( ) // expected-warning {{no 'async' operations occur within 'await' expression}}{{3-9=}}
247+ _ = ( g ( ) , await ( g ( ) ) ) // expected-warning {{no 'async' operations occur within 'await' expression}}{{13-19=}}
248+
249+ @MainActor struct MA {
250+ func f( ) { }
251+ func g( ) async {
252+ await f ( ) // expected-warning {{no 'async' operations occur within 'await' expression}}{{7-13=}}
253+ }
254+
255+ static func h( _ ma: MA ) async {
256+ await ma. f ( ) // expected-warning {{no 'async' operations occur within 'await' expression}}{{7-13=}}
257+ }
258+ }
259+
260+ actor A {
261+ func f( ) { }
262+ func g( ) async {
263+ await f ( ) // expected-warning {{no 'async' operations occur within 'await' expression}}{{7-13=}}
264+ }
265+ }
266+ }
You can’t perform that action at this time.
0 commit comments