File: complete_multifile.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (98 lines) | stat: -rw-r--r-- 4,353 bytes parent folder | download
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// RUN: %empty-directory(%t)
// RUN: %{python} %utils/split_file.py -o %t %s

// RUN: %target-swift-ide-test -code-completion -source-filename %t/Main.swift %t/Library.swift -code-completion-token=POINT_PAREN | %FileCheck --check-prefix=POINT_PAREN %s
// RUN: %target-swift-ide-test -code-completion -source-filename %t/Main.swift %t/Library.swift -code-completion-token=POINT_DOT | %FileCheck --check-prefix=POINT_DOT %s
// RUN: %target-swift-ide-test -code-completion -source-filename %t/Main.swift %t/Library.swift -code-completion-token=LENS_DOT | %FileCheck --check-prefix=LENS_DOT %s
// RUN: %target-swift-ide-test -code-completion -source-filename %t/Main.swift %t/Library.swift -code-completion-token=MYENUM_DOT | %FileCheck --check-prefix=MYENUM_DOT %s
// RUN: %target-swift-ide-test -code-completion -source-filename %t/Main.swift %t/Library.swift -code-completion-token=MYENUM_INSTANCE_DOT | %FileCheck --check-prefix=MYENUM_INSTANCE_DOT %s
// RUN: %target-swift-ide-test -code-completion -source-filename %t/Main.swift %t/Library.swift -code-completion-token=HASWRAPPED_DOT| %FileCheck --check-prefix=HASWRAPPED_DOT %s

// BEGIN Library.swift

public struct Point {
  var x: Int
  var y: Int
}

@dynamicMemberLookup
struct Lens<T> {
  var obj: T
  init(_ obj: T) { self.obj = obj }

  subscript<U>(dynamicMember member: WritableKeyPath<T, U>) -> Lens<U> {
    get { return Lens<U>(obj[keyPath: member]) }
    set { obj[keyPath: member] = newValue.obj }
  }
}

enum MyEnum: String, CaseIterable {
  case foo = "foo"
  case bar = "bar"
}

@propertyWrapper
struct Wrap<T> {
  var wrappedValue: T

  public var projectedValue: Self {
    get { self }
    set { self = newValue }
  }
}

struct HasWrapped {
  @Wrap
  var wrapped: Int = 1
}

// BEGIN Main.swift

func testStructDefaultInit() {
  Point(#^POINT_PAREN^#
// POINT_PAREN: Begin completions, 1 items
// POINT_PAREN-DAG: Decl[Constructor]/CurrNominal/Flair[ArgLabels]:      ['(']{#x: Int#}, {#y: Int#}[')'][#Point#];
  func sync() {}
  Point.#^POINT_DOT^#
// POINT_DOT: Begin completions, 3 items
// POINT_DOT-DAG: Keyword[self]/CurrNominal:          self[#Point.Type#];
// POINT_DOT-DAG: Keyword/CurrNominal:                Type[#Point.Type#];
// POINT_DOT-DAG: Decl[Constructor]/CurrNominal:      init({#x: Int#}, {#y: Int#})[#Point#];
}

func testDynamicMemberLookup(lens: Lens<Point>) {
  _ = lens.#^LENS_DOT^#
// LENS_DOT: Begin completions, 4 items
// LENS_DOT-DAG: Keyword[self]/CurrNominal:          self[#Lens<Point>#];
// LENS_DOT-DAG: Decl[InstanceVar]/CurrNominal:      x[#Lens<Int>#];
// LENS_DOT-DAG: Decl[InstanceVar]/CurrNominal:      y[#Lens<Int>#];
// LENS_DOT-DAG: Decl[InstanceVar]/CurrNominal:      obj[#Point#];
}
func testRawRepresentable() {
  MyEnum.#^MYENUM_DOT^#
// MYENUM_DOT: Begin completions, 9 items
// MYENUM_DOT-DAG: Keyword[self]/CurrNominal:          self[#MyEnum.Type#];
// MYENUM_DOT-DAG: Keyword/CurrNominal:                Type[#MyEnum.Type#];
// MYENUM_DOT-DAG: Decl[EnumElement]/CurrNominal:      foo[#MyEnum#];
// MYENUM_DOT-DAG: Decl[EnumElement]/CurrNominal:      bar[#MyEnum#];
// MYENUM_DOT-DAG: Decl[TypeAlias]/CurrNominal:        RawValue[#String#];
// MYENUM_DOT-DAG: Decl[Constructor]/CurrNominal:      init({#rawValue: String#})[#MyEnum?#];
// MYENUM_DOT-DAG: Decl[TypeAlias]/CurrNominal:        AllCases[#[MyEnum]#];
// MYENUM_DOT-DAG: Decl[StaticVar]/CurrNominal:        allCases[#[MyEnum]#];
// MYENUM_DOT-DAG: Decl[InstanceMethod]/Super/IsSystem: hash({#(self): MyEnum#})[#(into: inout Hasher) -> Void#];
}
func testRawRepesentableInstance(value: MyEnum) {
  value.#^MYENUM_INSTANCE_DOT^#
// MYENUM_INSTANCE_DOT: Begin completions, 4 items
// MYENUM_INSTANCE_DOT-DAG: Keyword[self]/CurrNominal:          self[#MyEnum#];
// MYENUM_INSTANCE_DOT-DAG: Decl[InstanceVar]/CurrNominal:      rawValue[#String#];
// MYENUM_INSTANCE_DOT-DAG: Decl[InstanceVar]/Super/IsSystem:   hashValue[#Int#];
// MYENUM_INSTANCE_DOT-DAG: Decl[InstanceMethod]/Super/IsSystem: hash({#into: &Hasher#})[#Void#];
}
func testHasWrappedValue(value: HasWrapped) {
  value.#^HASWRAPPED_DOT^#
// HASWRAPPED_DOT: Begin completions, 3 items
// HASWRAPPED_DOT: Keyword[self]/CurrNominal:          self[#HasWrapped#];
// HASWRAPPED_DOT: Decl[InstanceVar]/CurrNominal:      wrapped[#Int#];
// HASWRAPPED_DOT: Decl[InstanceVar]/CurrNominal:      $wrapped[#Wrap<Int>#];
}