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
Initializers can’t be made final, but they *can* be made @nonobjc. (This isn’t always enough to ensure they’re actually valid, but I’ll get to that in a follow-up commit.)
Copy file name to clipboardExpand all lines: test/decl/ext/objc_implementation.swift
+30
Original file line number
Diff line number
Diff line change
@@ -183,6 +183,36 @@ protocol EmptySwiftProto {}
183
183
classfunc instanceMethod2(_:CInt){
184
184
// expected-warning@-1 {{class method 'instanceMethod2' does not match instance method declared in header; this will become an error before '@_objcImplementation' is stabilized}} {{3-9=}}
185
185
}
186
+
187
+
publicinit(notFromHeader1:CInt){
188
+
// expected-warning@-1 {{initializer 'init(notFromHeader1:)' does not match any initializer declared in the headers for 'ObjCClass'; did you use the initializer's Swift name?}}
189
+
// expected-note@-2 {{add 'private' or 'fileprivate' to define an Objective-C-compatible initializer not declared in the header}} {{3-9=private}}
190
+
// expected-note@-3 {{add '@nonobjc' to define a Swift-only initializer}} {{3-3=@nonobjc }}
191
+
}
192
+
193
+
publicrequiredinit(notFromHeader2:CInt){
194
+
// expected-warning@-1 {{initializer 'init(notFromHeader2:)' does not match any initializer declared in the headers for 'ObjCClass'; did you use the initializer's Swift name?}}
195
+
// expected-note@-2 {{add 'private' or 'fileprivate' to define an Objective-C-compatible initializer not declared in the header}} {{3-9=private}}
196
+
// expected-note@-3 {{add '@nonobjc' to define a Swift-only initializer}} {{3-3=@nonobjc }}
197
+
}
198
+
199
+
publicconvenienceinit(notFromHeader3:CInt){
200
+
// expected-warning@-1 {{initializer 'init(notFromHeader3:)' does not match any initializer declared in the headers for 'ObjCClass'; did you use the initializer's Swift name?}}
201
+
// expected-note@-2 {{add 'private' or 'fileprivate' to define an Objective-C-compatible initializer not declared in the header}} {{3-9=private}}
202
+
// expected-note@-3 {{add '@nonobjc' to define a Swift-only initializer}} {{3-3=@nonobjc }}
203
+
}
204
+
205
+
@nonobjcpublicinit(notFromHeader4:CInt){
206
+
// FIXME: Should be an error; requires a vtable entry
207
+
}
208
+
209
+
@nonobjcpublicrequiredinit(notFromHeader5:CInt){
210
+
// FIXME: Should be an error; requires a vtable entry
0 commit comments