1
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_VAR_INIT | %FileCheck %s -check-prefix=STRUCT_STATIC
2
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_VAR_INIT | %FileCheck %s -check-prefix=STRUCT_STATIC
3
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_LAZY_VAR_INIT | %FileCheck %s -check-prefix=STRUCT_INSTANCE
4
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_VAR_BODY | %FileCheck %s -check-prefix=STRUCT_INSTANCE
5
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_VAR_BODY | %FileCheck %s -check-prefix=STRUCT_STATIC
6
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INITIALIZER_DEFAULTPARAM | %FileCheck %s -check-prefix=STRUCT_STATIC
7
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INITIALIZER_BODY | %FileCheck %s -check-prefix=STRUCT_INSTANCE
8
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_FUNC_DEFAULTPARAM | %FileCheck %s -check-prefix=STRUCT_STATIC
9
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_FUNC_BODY | %FileCheck %s -check-prefix=STRUCT_INSTANCE
10
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_FUNC_DEFAULTPARAM | %FileCheck %s -check-prefix=STRUCT_STATIC
11
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_FUNC_BODY | %FileCheck %s -check-prefix=STRUCT_STATIC
12
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_SUBSCRIPT_DEFAULTPARAM | %FileCheck %s -check-prefix=STRUCT_STATIC
13
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_SUBSCRIPT_BODY | %FileCheck %s -check-prefix=STRUCT_INSTANCE
14
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_SUBSCRIPT_DEFAULTPARAM | %FileCheck %s -check-prefix=STRUCT_STATIC
15
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_SUBSCRIPT_BODY | %FileCheck %s -check-prefix=STRUCT_STATIC
16
-
17
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_VAR_INIT | %FileCheck %s -check-prefix=ENUM_STATIC
18
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INSTANCE_VAR_BODY | %FileCheck %s -check-prefix=ENUM_INSTANCE
19
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_VAR_BODY | %FileCheck %s -check-prefix=ENUM_STATIC
20
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INITIALIZER_DEFAULTPARAM | %FileCheck %s -check-prefix=ENUM_STATIC
21
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INITIALIZER_BODY | %FileCheck %s -check-prefix=ENUM_INSTANCE
22
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INSTANCE_FUNC_DEFAULTPARAM | %FileCheck %s -check-prefix=ENUM_STATIC
23
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INSTANCE_FUNC_BODY | %FileCheck %s -check-prefix=ENUM_INSTANCE
24
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_FUNC_DEFAULTPARAM | %FileCheck %s -check-prefix=ENUM_STATIC
25
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_FUNC_BODY | %FileCheck %s -check-prefix=ENUM_STATIC
26
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INSTANCE_SUBSCRIPT_DEFAULTPARAM | %FileCheck %s -check-prefix=ENUM_STATIC
27
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INSTANCE_SUBSCRIPT_BODY | %FileCheck %s -check-prefix=ENUM_INSTANCE
28
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_SUBSCRIPT_DEFAULTPARAM | %FileCheck %s -check-prefix=ENUM_STATIC
29
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_SUBSCRIPT_BODY | %FileCheck %s -check-prefix=ENUM_STATIC
30
-
1
+ // RUN: %batch-code-completion
31
2
32
3
// STRUCT_INSTANCE-NOT: init()
33
4
// STRUCT_INSTANCE-NOT: staticVar
@@ -53,29 +24,29 @@ struct MyStruct {
53
24
var instanceVar : Int { 1 }
54
25
func instanceFunc( ) -> Int { 1 }
55
26
56
- var testInstanceVarInit : String = ( #^STRUCT_INSTANCE_VAR_INIT^#)
57
- static var testStaticVarInit : String = ( #^STRUCT_STATIC_VAR_INIT^#)
58
- lazy var testLazyVarInit : String = ( #^STRUCT_LAZY_VAR_INIT^#)
27
+ var testInstanceVarInit: String = ( #^STRUCT_INSTANCE_VAR_INIT? check = STRUCT_STATIC ^#)
28
+ static var testStaticVarInit: String = ( #^STRUCT_STATIC_VAR_INIT? check = STRUCT_STATIC ^#)
29
+ lazy var testLazyVarInit: String = ( #^STRUCT_LAZY_VAR_INIT? check = STRUCT_INSTANCE ^#)
59
30
var testInstanceVar: String {
60
- #^STRUCT_INSTANCE_VAR_BODY^#
31
+ #^STRUCT_INSTANCE_VAR_BODY? check = STRUCT_INSTANCE ^#
61
32
}
62
33
static var testStaticVar: String {
63
- #^STRUCT_STATIC_VAR_BODY^#
34
+ #^STRUCT_STATIC_VAR_BODY? check = STRUCT_STATIC ^#
64
35
}
65
- init ( testInit: String = #^STRUCT_INITIALIZER_DEFAULTPARAM^#) {
66
- #^STRUCT_INITIALIZER_BODY^#
36
+ init ( testInit: String = #^STRUCT_INITIALIZER_DEFAULTPARAM? check = STRUCT_STATIC ^#) {
37
+ #^STRUCT_INITIALIZER_BODY? check = STRUCT_INSTANCE ^#
67
38
}
68
- func testInstanceMethod( x: String = #^STRUCT_INSTANCE_FUNC_DEFAULTPARAM^#) {
69
- #^STRUCT_INSTANCE_FUNC_BODY^#
39
+ func testInstanceMethod( x: String = #^STRUCT_INSTANCE_FUNC_DEFAULTPARAM? check = STRUCT_STATIC ^#) {
40
+ #^STRUCT_INSTANCE_FUNC_BODY? check = STRUCT_INSTANCE ^#
70
41
}
71
- static func testStaticMethod( x: String = #^STRUCT_STATIC_FUNC_DEFAULTPARAM^#) {
72
- #^STRUCT_STATIC_FUNC_BODY^#
42
+ static func testStaticMethod( x: String = #^STRUCT_STATIC_FUNC_DEFAULTPARAM? check = STRUCT_STATIC ^#) {
43
+ #^STRUCT_STATIC_FUNC_BODY? check = STRUCT_STATIC ^#
73
44
}
74
- subscript( testInstanceSubscript idx: String = #^STRUCT_INSTANCE_SUBSCRIPT_DEFAULTPARAM^#) {
75
- #^STRUCT_INSTANCE_SUBSCRIPT_BODY^#
45
+ subscript ( testInstanceSubscript idx: String = #^STRUCT_INSTANCE_SUBSCRIPT_DEFAULTPARAM? check = STRUCT_STATIC ^#) {
46
+ #^STRUCT_INSTANCE_SUBSCRIPT_BODY? check = STRUCT_INSTANCE ^#
76
47
}
77
- static subscript( testStaticSubscript idx: String = #^STRUCT_STATIC_SUBSCRIPT_DEFAULTPARAM^#) {
78
- #^STRUCT_STATIC_SUBSCRIPT_BODY^#
48
+ static subscript( testStaticSubscript idx: String = #^STRUCT_STATIC_SUBSCRIPT_DEFAULTPARAM? check = STRUCT_STATIC ^#) {
49
+ #^STRUCT_STATIC_SUBSCRIPT_BODY? check = STRUCT_STATIC ^#
79
50
}
80
51
}
81
52
@@ -110,26 +81,36 @@ enum MyEnum {
110
81
var instanceVar : Int { 1 }
111
82
func instanceFunc( ) -> Int { 1 }
112
83
113
- static var testStaticVarInit : String = ( #^ENUM_STATIC_VAR_INIT^#)
84
+ static var testStaticVarInit: String = ( #^ENUM_STATIC_VAR_INIT? check = ENUM_STATIC ^#)
114
85
var testInstanceVar: String {
115
- #^ENUM_INSTANCE_VAR_BODY^#
86
+ #^ENUM_INSTANCE_VAR_BODY? check = ENUM_INSTANCE ^#
116
87
}
117
88
static var testStaticVar: String {
118
- #^ENUM_STATIC_VAR_BODY^#
89
+ #^ENUM_STATIC_VAR_BODY? check = ENUM_STATIC^#
90
+ }
91
+ init ( testInit: String = #^ENUM_INITIALIZER_DEFAULTPARAM? check= ENUM_STATIC^#) {
92
+ #^ENUM_INITIALIZER_BODY? check= ENUM_INSTANCE^#
119
93
}
120
- func init ( testInit : String = #^ENUM_INITIALIZER_DEFAULTPARAM ^#) {
121
- #^ENUM_INITIALIZER_BODY ^#
94
+ func testInstanceMethod ( x : String = #^ENUM_INSTANCE_FUNC_DEFAULTPARAM ? check = ENUM_STATIC ^#) {
95
+ #^ENUM_INSTANCE_FUNC_BODY ? check = ENUM_INSTANCE ^#
122
96
}
123
- func testInstanceMethod ( x: String = #^ENUM_INSTANCE_FUNC_DEFAULTPARAM ^#) {
124
- #^ENUM_INSTANCE_FUNC_BODY ^#
97
+ static func testStaticMethod ( x: String = #^ENUM_STATIC_FUNC_DEFAULTPARAM ? check = ENUM_STATIC ^#) {
98
+ #^ENUM_STATIC_FUNC_BODY ? check = ENUM_STATIC ^#
125
99
}
126
- static func testStaticMethod ( x : String = #^ENUM_STATIC_FUNC_DEFAULTPARAM ^#) {
127
- #^ENUM_STATIC_FUNC_BODY ^#
100
+ subscript ( testInstanceSubscript idx : String = #^ENUM_INSTANCE_SUBSCRIPT_DEFAULTPARAM ? check = ENUM_STATIC ^#) {
101
+ #^ENUM_INSTANCE_SUBSCRIPT_BODY ? check = ENUM_INSTANCE ^#
128
102
}
129
- subscript( testInstanceSubscript idx: String = #^ENUM_INSTANCE_SUBSCRIPT_DEFAULTPARAM ^#) {
130
- #^ENUM_INSTANCE_SUBSCRIPT_BODY ^#
103
+ static subscript( testStaticSubscript idx: String = #^ENUM_STATIC_SUBSCRIPT_DEFAULTPARAM ? check = ENUM_STATIC ^#) {
104
+ #^ENUM_STATIC_SUBSCRIPT_BODY ? check = ENUM_STATIC ^#
131
105
}
132
- static subscript( testStaticSubscript idx: String = #^ENUM_STATIC_SUBSCRIPT_DEFAULTPARAM^#) {
133
- #^ENUM_STATIC_SUBSCRIPT_BODY^#
106
+ }
107
+
108
+ // rdar://123790296
109
+ func testBindingFromDefer( _ x: Int ? ) {
110
+ guard let bar = x else { return }
111
+ defer {
112
+ #^BINDING_FROM_DEFER^#
113
+ // BINDING_FROM_DEFER-DAG: Decl[LocalVar]/Local: x[#Int?#]; name=x
114
+ // BINDING_FROM_DEFER-DAG: Decl[LocalVar]/Local: bar[#Int#]; name=bar
134
115
}
135
116
}
0 commit comments