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
I recently ran into a nasty crashing bug in my codebase because I had a return AnyPromise() in some edge case. I wasn't aware that it was illegal to construct AnyPromise() without any arguments.
AnyPromise's default argument-less init initializer is correctly marked as unavailable in the Objective-C header (see https://github.com/mxcl/PromiseKit/blob/master/Sources/AnyPromise.h#L295).
When trying to call it from Objective-C with [[AnyPromise alloc] init] the compiler correctly complains. However, there's no warning and no compiler error when illegally constructing it from Swift using AnyPromise(). Is there a way to work around for this? I've tried a few, but to no avail. Shouldn't the Swift compiler pick up the Objective-C unavailable declaration in AnyPromise.h? So is there any solution we could implement for this?
I recently ran into a nasty crashing bug in my codebase because I had a
return AnyPromise()
in some edge case. I wasn't aware that it was illegal to constructAnyPromise()
without any arguments.AnyPromise
's default argument-lessinit
initializer is correctly marked asunavailable
in the Objective-C header (see https://github.com/mxcl/PromiseKit/blob/master/Sources/AnyPromise.h#L295).When trying to call it from Objective-C with
[[AnyPromise alloc] init]
the compiler correctly complains. However, there's no warning and no compiler error when illegally constructing it from Swift usingAnyPromise()
. Is there a way to work around for this? I've tried a few, but to no avail. Shouldn't the Swift compiler pick up the Objective-Cunavailable
declaration inAnyPromise.h
? So is there any solution we could implement for this?Here's a related discussion with an Apple Engineer: https://developer.apple.com/forums/thread/650054?login=true&page=1#648364022
The text was updated successfully, but these errors were encountered: