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