@@ -182,10 +182,18 @@ func alreadyThrows(completion: (String) -> Void) throws { }
182182// RUN: not %refactor -add-async-alternative -dump-text -source-filename %s -pos=%(line+1):1
183183func noParamAutoclosure( completion: @autoclosure ( ) -> Void ) { }
184184
185+ // RUN: %refactor -add-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix BLOCK-CONVENTION %s
186+ func blockConvention( completion: @convention ( block) ( ) -> Void ) { }
187+ // BLOCK-CONVENTION: func blockConvention() async { }
188+
189+ // RUN: %refactor -add-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix C-CONVENTION %s
190+ func cConvention( completion: @convention ( c) ( ) -> Void ) { }
191+ // C-CONVENTION: func cConvention() async { }
192+
185193// 2. Check that the various ways to call a function (and the positions the
186194// refactoring is called from) are handled correctly
187195
188- // 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
196+ // 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
189197func testCalls( ) {
190198// CONVERT-FUNC: {{^}}func testCalls() async {
191199 // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+4):3 | %FileCheck -check-prefix=CALL %s
@@ -326,5 +334,19 @@ func testCalls() {
326334 }
327335 // DEFAULT-ARGS-CALL: let str = await defaultArgs(a: 1, b: 2){{$}}
328336 // DEFAULT-ARGS-CALL-NEXT: {{^}}print("defaultArgs")
337+
338+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):3 | %FileCheck -check-prefix=BLOCK-CONVENTION-CALL %s
339+ blockConvention {
340+ print ( " blockConvention " )
341+ }
342+ // BLOCK-CONVENTION-CALL: await blockConvention(){{$}}
343+ // BLOCK-CONVENTION-CALL-NEXT: {{^}}print("blockConvention")
344+
345+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):3 | %FileCheck -check-prefix=C-CONVENTION-CALL %s
346+ cConvention {
347+ print ( " cConvention " )
348+ }
349+ // C-CONVENTION-CALL: await cConvention(){{$}}
350+ // C-CONVENTION-CALL-NEXT: {{^}}print("cConvention")
329351}
330352// CONVERT-FUNC: {{^}}}
0 commit comments