@@ -176,10 +176,18 @@ func alreadyThrows(completion: (String) -> Void) throws { }
176176// RUN: not %refactor -add-async-alternative -dump-text -source-filename %s -pos=%(line+1):1
177177func noParamAutoclosure( completion: @autoclosure ( ) -> Void ) { }
178178
179+ // RUN: %refactor -add-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix BLOCK-CONVENTION %s
180+ func blockConvention( completion: @convention ( block) ( ) -> Void ) { }
181+ // BLOCK-CONVENTION: func blockConvention() async { }
182+
183+ // RUN: %refactor -add-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix C-CONVENTION %s
184+ func cConvention( completion: @convention ( c) ( ) -> Void ) { }
185+ // C-CONVENTION: func cConvention() async { }
186+
179187// 2. Check that the various ways to call a function (and the positions the
180188// refactoring is called from) are handled correctly
181189
182- // RUN: %refactor -convert-to-async -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefixes=CONVERT-FUNC,CALL,CALL-NOLABEL,CALL-WRAPPED,TRAILING,TRAILING-PARENS,TRAILING-WRAPPED,CALL-ARG,MANY-CALL,MEMBER-CALL,MEMBER-CALL2,MEMBER-PARENS,EMPTY-CAPTURE,CAPTURE,DEFAULT-ARGS-MISSING,DEFAULT-ARGS-CALL %s
190+ // RUN: %refactor -convert-to-async -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefixes=CONVERT-FUNC,CALL,CALL-NOLABEL,CALL-WRAPPED,TRAILING,TRAILING-PARENS,TRAILING-WRAPPED,CALL-ARG,MANY-CALL,MEMBER-CALL,MEMBER-CALL2,MEMBER-PARENS,EMPTY-CAPTURE,CAPTURE,DEFAULT-ARGS-MISSING,DEFAULT-ARGS-CALL,BLOCK-CONVENTION-CALL,C-CONVENTION-CALL %s
183191func testCalls( ) {
184192// CONVERT-FUNC: {{^}}func testCalls() async {
185193 // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+4):3 | %FileCheck -check-prefix=CALL %s
@@ -320,5 +328,19 @@ func testCalls() {
320328 }
321329 // DEFAULT-ARGS-CALL: let str = await defaultArgs(a: 1, b: 2){{$}}
322330 // DEFAULT-ARGS-CALL-NEXT: {{^}}print("defaultArgs")
331+
332+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):3 | %FileCheck -check-prefix=BLOCK-CONVENTION-CALL %s
333+ blockConvention {
334+ print ( " blockConvention " )
335+ }
336+ // BLOCK-CONVENTION-CALL: await blockConvention(){{$}}
337+ // BLOCK-CONVENTION-CALL-NEXT: {{^}}print("blockConvention")
338+
339+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):3 | %FileCheck -check-prefix=C-CONVENTION-CALL %s
340+ cConvention {
341+ print ( " cConvention " )
342+ }
343+ // C-CONVENTION-CALL: await cConvention(){{$}}
344+ // C-CONVENTION-CALL-NEXT: {{^}}print("cConvention")
323345}
324346// CONVERT-FUNC: {{^}}}
0 commit comments