You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/SILOptimizer/definite_init_cross_module_swift4.swift
+46Lines changed: 46 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,10 @@ extension Point {
10
10
self.y = yy
11
11
}
12
12
13
+
init(xx:Double){
14
+
self.x = xx // expected-warning {{initializer for struct 'Point' must use "self.init(...)" or "self = ..." because it is not in module 'OtherModule'}}
15
+
} // expected-error {{return from initializer without initializing all stored properties}}
16
+
13
17
init(xxx:Double, yyy:Double){
14
18
// This is OK
15
19
self.init(x: xxx, y: yyy)
@@ -234,8 +238,50 @@ extension PrivatePoint {
234
238
self= other
235
239
}
236
240
241
+
init(other:PrivatePoint, cond:Bool){
242
+
if cond {self= other }
243
+
} // expected-error {{return from initializer without initializing all stored properties}}
244
+
237
245
// Ideally we wouldn't mention the names of non-public stored properties
238
246
// across module boundaries, but this will go away in Swift 5 mode anyway.
239
247
init(){
240
248
} // expected-error {{return from initializer without initializing all stored properties}}
241
249
}
250
+
251
+
extensionEmpty{
252
+
init(x:Double){
253
+
// This is OK
254
+
self.init()
255
+
}
256
+
257
+
init(other:Empty){
258
+
// This is okay
259
+
self= other
260
+
}
261
+
262
+
init(other:Empty, cond:Bool){
263
+
if cond {self= other }
264
+
} // expected-warning {{initializer for struct 'Empty' must use "self.init(...)" or "self = ..." on all paths because it is not in module 'OtherModule'}}
265
+
266
+
init(xx:Double){
267
+
} // expected-warning {{initializer for struct 'Empty' must use "self.init(...)" or "self = ..." because it is not in module 'OtherModule'}}
268
+
}
269
+
270
+
extensionGenericEmpty{
271
+
init(x:Double){
272
+
// This is OK
273
+
self.init()
274
+
}
275
+
276
+
init(other:GenericEmpty<T>){
277
+
// This is okay
278
+
self= other
279
+
}
280
+
281
+
init(other:GenericEmpty<T>, cond:Bool){
282
+
if cond {self= other }
283
+
} // expected-warning {{initializer for struct 'GenericEmpty<T>' must use "self.init(...)" or "self = ..." on all paths because it is not in module 'OtherModule'}}
284
+
285
+
init(xx:Double){
286
+
} // expected-warning {{initializer for struct 'GenericEmpty<T>' must use "self.init(...)" or "self = ..." because it is not in module 'OtherModule'}}
0 commit comments