File tree Expand file tree Collapse file tree 3 files changed +44
-1
lines changed
Inputs/definite_init_cross_module Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -24,3 +24,12 @@ public struct GenericPoint<T> {
24
24
self . y = y
25
25
}
26
26
}
27
+
28
+ public struct PrivatePoint {
29
+ private var x , y : Double
30
+
31
+ public init ( x: Double , y: Double ) {
32
+ self . x = x
33
+ self . y = y
34
+ }
35
+ }
Original file line number Diff line number Diff line change @@ -181,3 +181,19 @@ extension NonnullWrapper {
181
181
// zeroing initializer.
182
182
} // expected-error {{'self.init' isn't called on all paths before returning from initializer}}
183
183
}
184
+
185
+
186
+ extension PrivatePoint {
187
+ init ( xxx: Double , yyy: Double ) {
188
+ // This is OK
189
+ self . init ( x: xxx, y: yyy)
190
+ }
191
+
192
+ init ( other: PrivatePoint ) {
193
+ // This is OK
194
+ self = other
195
+ }
196
+
197
+ init ( ) {
198
+ } // expected-error {{'self.init' isn't called on all paths before returning from initializer}}
199
+ }
Original file line number Diff line number Diff line change 1
1
// RUN: %empty-directory(%t)
2
2
// RUN: %target-swift-frontend -emit-module -emit-module-path=%t/OtherModule.swiftmodule %S/Inputs/definite_init_cross_module/OtherModule.swift
3
- // RUN: %target-swift-frontend -emit-sil -verify -I %t -swift-version 4 %s > /dev/null -import-objc-header %S/Inputs/definite_init_cross_module/BridgingHeader.h
3
+ // RUN: %target-swift-frontend -emit-sil -verify -verify-ignore-unknown - I %t -swift-version 4 %s > /dev/null -import-objc-header %S/Inputs/definite_init_cross_module/BridgingHeader.h
4
4
5
5
import OtherModule
6
6
@@ -221,3 +221,21 @@ extension NonnullWrapper {
221
221
// zeroing initializer.
222
222
}
223
223
}
224
+
225
+
226
+ extension PrivatePoint {
227
+ init ( xxx: Double , yyy: Double ) {
228
+ // This is OK
229
+ self . init ( x: xxx, y: yyy)
230
+ }
231
+
232
+ init ( other: PrivatePoint ) {
233
+ // This is OK
234
+ self = other
235
+ }
236
+
237
+ // Ideally we wouldn't mention the names of non-public stored properties
238
+ // across module boundaries, but this will go away in Swift 5 mode anyway.
239
+ init ( ) {
240
+ } // expected-error {{return from initializer without initializing all stored properties}}
241
+ }
You can’t perform that action at this time.
0 commit comments