File: handler_position.swift

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (43 lines) | stat: -rw-r--r-- 2,717 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// REQUIRES: concurrency

// RUN: %empty-directory(%t)

// RUN: %refactor-check-compiles -add-async-alternative -dump-text -source-filename %s -pos=%(line+2):1 | %FileCheck -check-prefix=FIRST-ARG %s
// RUN: %refactor-check-compiles -add-async-wrapper -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix=FIRST-ARG-WRAPPER %s
func completionFirst(/*c1s*/ completion: @escaping (String) -> Void /*c1e*/, /*c2s*/ arg: Int /*c2e*/) { }

// FIRST-ARG:      @available(*, renamed: "completionFirst(arg:)")
// FIRST-ARG:      Task {
// FIRST-ARG-NEXT:   let result = await completionFirst(arg: arg)
// FIRST-ARG-NEXT:   completion(result)
// FIRST-ARG-NEXT: }
// FIRST-ARG:      func completionFirst(/*c2s*/ arg: Int /*c2e*/) async -> String { }

// FIRST-ARG-WRAPPER:      @available(*, renamed: "completionFirst(arg:)")
// FIRST-ARG-WRAPPER:      func completionFirst(/*c2s*/ arg: Int /*c2e*/) async -> String {
// FIRST-ARG-WRAPPER-NEXT:   return await withCheckedContinuation { continuation in
// FIRST-ARG-WRAPPER-NEXT:     completionFirst(completion: { result in
// FIRST-ARG-WRAPPER-NEXT:       continuation.resume(returning: result)
// FIRST-ARG-WRAPPER-NEXT:     }, arg: arg)
// FIRST-ARG-WRAPPER-NEXT:   }
// FIRST-ARG-WRAPPER-NEXT: }

// RUN: %refactor-check-compiles -add-async-alternative -dump-text -source-filename %s -pos=%(line+2):1 | %FileCheck -check-prefix MIDDLE-ARG %s
// RUN: %refactor-check-compiles -add-async-wrapper -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix=MIDDLE-ARG-WRAPPER %s
func completionMiddle(/*c1s*/ arg1: Int /*c1e*/, /*c2s*/ _ arg2: Int /*c2e*/, /*c3s*/ completion: @escaping (String) -> Void /*c3e*/, /*c4s*/ arg3: Int /*c4e*/) { }

// MIDDLE-ARG:      @available(*, renamed: "completionMiddle(arg1:_:arg3:)")
// MIDDLE-ARG:      Task {
// MIDDLE-ARG-NEXT:   let result = await completionMiddle(arg1: arg1, arg2, arg3: arg3)
// MIDDLE-ARG-NEXT:   completion(result)
// MIDDLE-ARG-NEXT: }
// MIDDLE-ARG:      func completionMiddle(/*c1s*/ arg1: Int /*c1e*/, /*c2s*/ _ arg2: Int /*c2e*/, /*c4s*/ arg3: Int /*c4e*/) async -> String { }

// MIDDLE-ARG-WRAPPER:      @available(*, renamed: "completionMiddle(arg1:_:arg3:)")
// MIDDLE-ARG-WRAPPER:      func completionMiddle(/*c1s*/ arg1: Int /*c1e*/, /*c2s*/ _ arg2: Int /*c2e*/, /*c4s*/ arg3: Int /*c4e*/) async -> String {
// MIDDLE-ARG-WRAPPER-NEXT:   return await withCheckedContinuation { continuation in
// MIDDLE-ARG-WRAPPER-NEXT:     completionMiddle(arg1: arg1, arg2, completion: { result in
// MIDDLE-ARG-WRAPPER-NEXT:       continuation.resume(returning: result)
// MIDDLE-ARG-WRAPPER-NEXT:     }, arg3: arg3)
// MIDDLE-ARG-WRAPPER-NEXT:   }
// MIDDLE-ARG-WRAPPER-NEXT: }