File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
test/refactoring/ConvertAsync Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -6461,7 +6461,8 @@ class AsyncConverter : private SourceEntityWalker {
6461
6461
// for the completion handler call, e.g 'return completion(args...)'. In
6462
6462
// that case, be sure not to add another return.
6463
6463
auto *parent = getWalker ().Parent .getAsStmt ();
6464
- AddedReturnOrThrow = !(parent && isa<ReturnStmt>(parent));
6464
+ AddedReturnOrThrow = !(parent && isa<ReturnStmt>(parent) &&
6465
+ !cast<ReturnStmt>(parent)->isImplicit ());
6465
6466
if (AddedReturnOrThrow)
6466
6467
OS << tok::kw_return;
6467
6468
} else {
Original file line number Diff line number Diff line change @@ -329,3 +329,14 @@ func withDefaultArg(x: String = "") {
329
329
// DEFAULT-ARG: convert_function.swift [[# @LINE-3]]:1 -> [[# @LINE-2]]:2
330
330
// DEFAULT-ARG-NOT: @discardableResult
331
331
// DEFAULT-ARG-NEXT: {{^}}func withDefaultArg(x: String = "") async
332
+
333
+ // RUN: %refactor -convert-to-async -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix=IMPLICIT-RETURN %s
334
+ func withImplicitReturn( completionHandler: ( String ) -> Void ) {
335
+ simple {
336
+ completionHandler ( $0)
337
+ }
338
+ }
339
+ // IMPLICIT-RETURN: func withImplicitReturn() async -> String {
340
+ // IMPLICIT-RETURN-NEXT: let val0 = await simple()
341
+ // IMPLICIT-RETURN-NEXT: return val0
342
+ // IMPLICIT-RETURN-NEXT: }
You can’t perform that action at this time.
0 commit comments