@@ -134,27 +134,18 @@ struct AStruct {
134
134
}
135
135
}
136
136
137
- class AClass {
137
+ class AClass { // used for references only
138
138
var y : AStruct ;
139
139
var z : [ Int ]
140
-
141
140
init ( x: Int ) {
142
141
y = AStruct ( x: x)
143
142
self . z = [ 1 , 2 , 3 ]
144
143
}
145
-
146
144
subscript( index: Int ) -> Int {
147
- get {
148
- return z [ 0 ]
149
- }
150
- set {
151
- z [ 0 ] = newValue
152
- }
153
- }
154
-
155
- func foo( ) -> Int {
156
- return z [ 0 ]
145
+ get { return z [ 0 ] }
146
+ set { z [ 0 ] = newValue }
157
147
}
148
+ func foo( ) -> Int { return z [ 0 ] }
158
149
}
159
150
160
151
let _ = AClass . foo
@@ -168,21 +159,38 @@ let _ = AClass(x: 1)[1] = 2
168
159
// CHECK: [[@LINE-1]]:21 | instance-property/subscript/Swift | subscript(_:) | s:14swift_ide_test6AClassC9subscriptSiSici | Ref,Writ | rel: 0
169
160
// CHECK: [[@LINE-2]]:21 | function/acc-set/Swift | setter:subscript(_:) | s:14swift_ide_test6AClassC9subscriptSiSicfs | Ref,Call,Dyn,Impl,RelRec | rel: 1
170
161
162
+ // RelationBaseOf, RelationOverrideOf
163
+
164
+ protocol X { }
165
+ // CHECK: [[@LINE-1]]:10 | protocol/Swift | X | [[X_USR:.*]] | Def | rel: 0
166
+
167
+ class ImplementsX : X { }
168
+ // CHECK: [[@LINE-1]]:7 | class/Swift | ImplementsX | [[ImplementsX_USR:.*]] | Def | rel: 0
169
+ // CHECK: [[@LINE-2]]:21 | protocol/Swift | X | [[X_USR]] | Ref,RelBase | rel: 1
170
+ // CHECK-NEXT: RelBase | ImplementsX | [[ImplementsX_USR]]
171
+
171
172
protocol AProtocol {
172
173
// CHECK: [[@LINE-1]]:10 | protocol/Swift | AProtocol | [[AProtocol_USR:.*]] | Def | rel: 0
174
+
175
+ associatedtype T : X
176
+ // CHECK: [[@LINE-1]]:18 | type-alias/associated-type/Swift | T | s:14swift_ide_test9AProtocolP1T | Def,RelChild | rel: 1
177
+ // CHECK-NEXT: RelChild | AProtocol | [[AProtocol_USR]]
178
+ // CHECK: [[@LINE-3]]:22 | protocol/Swift | X | [[X_USR]] | Ref | rel: 0
179
+
173
180
func foo( ) -> Int
174
181
// CHECK: [[@LINE-1]]:8 | instance-method/Swift | foo() | s:14swift_ide_test9AProtocolP3fooSiyF | Def,RelChild | rel: 1
175
182
// CHECK-NEXT: RelChild | AProtocol | s:14swift_ide_test9AProtocolP
176
183
}
177
184
178
- // RelationBaseOf, RelationOverrideOf
179
185
class ASubClass : AClass , AProtocol {
180
186
// CHECK: [[@LINE-1]]:7 | class/Swift | ASubClass | s:14swift_ide_test9ASubClassC | Def | rel: 0
181
187
// CHECK: [[@LINE-2]]:19 | class/Swift | AClass | s:14swift_ide_test6AClassC | Ref,RelBase | rel: 1
182
188
// CHECK-NEXT: RelBase | ASubClass | s:14swift_ide_test9ASubClassC
183
189
// CHECK: [[@LINE-4]]:27 | protocol/Swift | AProtocol | s:14swift_ide_test9AProtocolP | Ref,RelBase | rel: 1
184
190
// CHECK-NEXT: RelBase | ASubClass | s:14swift_ide_test9ASubClassC
185
191
192
+ typealias T = ImplementsX
193
+
186
194
override func foo( ) -> Int {
187
195
// CHECK: [[@LINE-1]]:17 | instance-method/Swift | foo() | s:14swift_ide_test9ASubClassC3fooSiyF | Def,RelChild,RelOver | rel: 3
188
196
// CHECK-NEXT: RelOver | foo() | s:14swift_ide_test6AClassC3fooSiyF
@@ -216,7 +224,9 @@ extension OuterS.InnerS : AProtocol {
216
224
// CHECK: [[@LINE-4]]:27 | protocol/Swift | AProtocol | [[AProtocol_USR]] | Ref,RelBase | rel: 1
217
225
// CHECK-NEXT: RelBase | InnerS | [[EXT_INNERS_USR]]
218
226
// CHECK: [[@LINE-6]]:11 | struct/Swift | OuterS | [[OUTERS_USR]] | Ref | rel: 0
219
- func foo( ) { }
227
+
228
+ typealias T = ImplementsX
229
+ func foo( ) -> Int { return 1 }
220
230
}
221
231
222
232
var anInstance = AClass ( x: 1 )
0 commit comments