-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathcomplete_after_sself.swift
81 lines (76 loc) · 4.74 KB
/
complete_after_sself.swift
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
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_INIT_MyClass | %FileCheck %s --check-prefixes=CHECK-MyClass
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_DEINIT_MyClass | %FileCheck %s --check-prefixes=CHECK-MyClass
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_INIT_MyClass | %FileCheck %s --check-prefixes=CHECK-MyClass
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_INSTANCEMETHOD_MyClass | %FileCheck %s --check-prefixes=CHECK-MyClass
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_STATICMETHOD_MyClass | %FileCheck %s --check-prefixes=CHECK-MyClass
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_INIT_MyStruct | %FileCheck %s --check-prefixes=CHECK-MyStruct
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_DEINIT_MyStruct | %FileCheck %s --check-prefixes=CHECK-MyStruct
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_INIT_MyStruct | %FileCheck %s --check-prefixes=CHECK-MyStruct
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_INSTANCEMETHOD_MyStruct | %FileCheck %s --check-prefixes=CHECK-MyStruct
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_STATICMETHOD_MyStruct | %FileCheck %s --check-prefixes=CHECK-MyStruct
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_INIT_MyProto | %FileCheck %s --check-prefixes=CHECK-MyProto
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_DEINIT_MyProto | %FileCheck %s --check-prefixes=CHECK-MyProto
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_INIT_MyProto | %FileCheck %s --check-prefixes=CHECK-MyProto
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_INSTANCEMETHOD_MyProto | %FileCheck %s --check-prefixes=CHECK-MyProto
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SSELF_DOT_IN_STATICMETHOD_MyProto | %FileCheck %s --check-prefixes=CHECK-MyProto
class MyClass {
init() {
Self.#^SSELF_DOT_IN_INIT_MyClass^#
}
deinit {
Self.#^SSELF_DOT_IN_DEINIT_MyClass^#
}
func instanceMethod() {
Self.#^SSELF_DOT_IN_INSTANCEMETHOD_MyClass^#
}
static func staticMethod() {
Self.#^SSELF_DOT_IN_STATICMETHOD_MyClass^#
}
// CHECK-MyClass: Begin completions, 5 items
// CHECK-MyClass-DAG: Keyword[self]/CurrNominal: self[#Self.Type#];
// CHECK-MyClass-DAG: Keyword/CurrNominal: Type[#Self.Type#];
// CHECK-MyClass-DAG: Decl[Constructor]/CurrNominal: init()[#MyClass#];
// CHECK-MyClass-DAG: Decl[InstanceMethod]/CurrNominal: instanceMethod({#(self): MyClass#})[#() -> Void#];
// CHECK-MyClass-DAG: Decl[StaticMethod]/CurrNominal: staticMethod()[#Void#];
}
struct MyStruct {
init() {
Self.#^SSELF_DOT_IN_INIT_MyStruct^#
}
deinit {
Self.#^SSELF_DOT_IN_DEINIT_MyStruct^#
}
func instanceMethod() {
Self.#^SSELF_DOT_IN_INSTANCEMETHOD_MyStruct^#
}
static func staticMethod() {
Self.#^SSELF_DOT_IN_STATICMETHOD_MyStruct^#
}
// CHECK-MyStruct: Begin completions, 5 items
// CHECK-MyStruct-DAG: Keyword[self]/CurrNominal: self[#MyStruct.Type#];
// CHECK-MyStruct-DAG: Keyword/CurrNominal: Type[#MyStruct.Type#];
// CHECK-MyStruct-DAG: Decl[Constructor]/CurrNominal: init()[#MyStruct#];
// CHECK-MyStruct-DAG: Decl[InstanceMethod]/CurrNominal: instanceMethod({#(self): MyStruct#})[#() -> Void#];
// CHECK-MyStruct-DAG: Decl[StaticMethod]/CurrNominal: staticMethod()[#Void#];
}
protocol MyProto { }
extension MyProto {
init() {
Self.#^SSELF_DOT_IN_INIT_MyProto^#
}
deinit {
Self.#^SSELF_DOT_IN_DEINIT_MyProto^#
}
func instanceMethod() {
Self.#^SSELF_DOT_IN_INSTANCEMETHOD_MyProto^#
}
static func staticMethod() {
Self.#^SSELF_DOT_IN_STATICMETHOD_MyProto^#
}
// CHECK-MyProto: Begin completions, 5 items
// CHECK-MyProto-DAG: Keyword[self]/CurrNominal: self[#Self.Type#];
// CHECK-MyProto-DAG: Keyword/CurrNominal: Type[#Self.Type#];
// CHECK-MyProto-DAG: Decl[Constructor]/CurrNominal: init()[#MyProto#];
// CHECK-MyProto-DAG: Decl[InstanceMethod]/CurrNominal: instanceMethod({#(self): MyProto#})[#() -> Void#];
// CHECK-MyProto-DAG: Decl[StaticMethod]/CurrNominal: staticMethod()[#Void#];
}