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 {
64616461 // for the completion handler call, e.g 'return completion(args...)'. In
64626462 // that case, be sure not to add another return.
64636463 auto *parent = getWalker ().Parent .getAsStmt ();
6464- AddedReturnOrThrow = !(parent && isa<ReturnStmt>(parent));
6464+ AddedReturnOrThrow = !(parent && isa<ReturnStmt>(parent) &&
6465+ !cast<ReturnStmt>(parent)->isImplicit ());
64656466 if (AddedReturnOrThrow)
64666467 OS << tok::kw_return;
64676468 } else {
Original file line number Diff line number Diff line change @@ -329,3 +329,14 @@ func withDefaultArg(x: String = "") {
329329// DEFAULT-ARG: convert_function.swift [[# @LINE-3]]:1 -> [[# @LINE-2]]:2
330330// DEFAULT-ARG-NOT: @discardableResult
331331// 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