File: complete_param_specifier.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 (53 lines) | stat: -rw-r--r-- 2,009 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
44
45
46
47
48
49
50
51
52
53
// RUN: %batch-code-completion

func foo(x: #^FUNC_PARAM?check=SPECIFIER^#) {
  let fn1 = { (x: #CLOSURE_PARAM?check=SPECIFIER#) in }
  let fn2 = { (x: consuming #CLOSURE_PARAM2?check=SPECIFIER#) in }
  let fn3: (#^CLOSURE_PARAM_TY_COMPLETE?check=SPECIFIER^#) -> Void
  let fn4: (borrowing #^CLOSURE_PARAM_TY_COMPLETE2?check=SPECIFIER^#) -> Void
  let fn5: (#^CLOSURE_PARAM_TY_INCOMPLETE?check=SPECIFIER^#
  let fn6: (inout #^CLOSURE_PARAM_TY_INCOMPLETE2?check=SPECIFIER^#
}

func bar(_ x: borrowing #^FUNC_PARAM_2?check=SPECIFIER^#) {}

struct S {
  init(x: #^INIT_PARAM?check=SPECIFIER^#) {}
  subscript(x: #SUBSCRIPT_PARAM?check=SPECIFIER#) -> #^SUBSCRIPT_RET?check=RESULT;check=RESULT_NOT^# {}
}

// Don't complete for enum cases.
enum E {
  case e(#^ENUM_CASE_TY?check=SPECIFIER_NOT^#)
  case f(x: #^ENUM_CASE_LABELED_TY?check=SPECIFIER_NOT^#)
}

// Don't complete the parameter specifiers for a variable type.
//
// Note that we will still complete 'sending' here, even though it isn't
// currently supported for computed properties (it is supported for functions
// and subscripts though).
let x: #^VAR_TY?check=RESULT;check=RESULT_NOT^#
var y: #^VAR_TY2?check=RESULT;check=RESULT_NOT^#

// Or for a return type.
func bar() -> #^RESULT_TY?check=RESULT;check=RESULT_NOT^# {}

// SPECIFIER-DAG: Keyword[inout]/None: inout; name=inout
// SPECIFIER-DAG: Keyword/None: consuming; name=consuming
// SPECIFIER-DAG: Keyword/None: borrowing; name=borrowing
// SPECIFIER-DAG: Keyword/None: isolated; name=isolated
// SPECIFIER-DAG: Keyword/None: sending; name=sending

// SPECIFIER_NOT-NOT: Keyword[inout]/None: inout
// SPECIFIER_NOT-NOT: Keyword/None: consuming
// SPECIFIER_NOT-NOT: Keyword/None: borrowing
// SPECIFIER_NOT-NOT: Keyword/None: isolated
// SPECIFIER_NOT-NOT: Keyword/None: sending

// RESULT_NOT-NOT: Keyword[inout]/None: inout
// RESULT_NOT-NOT: Keyword/None: consuming
// RESULT_NOT-NOT: Keyword/None: borrowing
// RESULT_NOT-NOT: Keyword/None: isolated

// RESULT-DAG: Keyword/None: sending