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 @@ -6671,7 +6671,8 @@ class AsyncConverter : private SourceEntityWalker {
6671
6671
addRange (MidStartLoc, MidEndLoc);
6672
6672
6673
6673
// Third chunk: add in async and throws if necessary
6674
- OS << " async" ;
6674
+ if (!FD->hasAsync ())
6675
+ OS << " async" ;
6675
6676
if (FD->hasThrows () || TopHandler.HasError )
6676
6677
// TODO: Add throws if converting a function and it has a converted call
6677
6678
// without a do/catch
Original file line number Diff line number Diff line change @@ -21,6 +21,17 @@ func simpleErr(arg: String) async throws -> String { }
21
21
func simpleRes( arg: String , _ completion: @escaping ( Result < String , Error > ) -> Void ) { }
22
22
func simpleRes( arg: String ) async throws -> String { }
23
23
24
+ // RUN: %refactor-check-compiles -convert-to-async -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix=ALREADY-ASYNC %s
25
+ func alreadyAsync( ) async {
26
+ simple {
27
+ print ( $0)
28
+ }
29
+ }
30
+ // ALREADY-ASYNC: func alreadyAsync() async {
31
+ // ALREADY-ASYNC-NEXT: let val0 = await simple()
32
+ // ALREADY-ASYNC-NEXT: print(val0)
33
+ // ALREADY-ASYNC-NEXT: }
34
+
24
35
// RUN: %refactor-check-compiles -convert-to-async -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix=NESTED %s
25
36
func nested( ) {
26
37
simple {
You can’t perform that action at this time.
0 commit comments