mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This previously blew up if the Objective-C client passed NULL for the error parameter, but started working after the pointer nullability change. Why? John had /already written and committed/ code to handle NULL assuming pointer nullability was explicit, and that code was /correct as is/.
29 lines
767 B
Objective-C
29 lines
767 B
Objective-C
@import Foundation;
|
|
|
|
#pragma clang assume_nonnull begin
|
|
|
|
@protocol ErrorTest
|
|
- (nullable id)succeedAndReturnError:(NSError **)error;
|
|
- (nullable id)failAndReturnError:(NSError **)error;
|
|
@end
|
|
|
|
static id __nullable testSucceed(id <ErrorTest> __nonnull testObj) {
|
|
NSError *error = nil;
|
|
return [testObj succeedAndReturnError:&error];
|
|
}
|
|
|
|
static id __nullable testSucceedIgnoringError(id <ErrorTest> __nonnull testObj) {
|
|
return [testObj succeedAndReturnError:NULL];
|
|
}
|
|
|
|
static id __nullable testFail(id <ErrorTest> __nonnull testObj) {
|
|
NSError *error = nil;
|
|
return [testObj failAndReturnError:&error];
|
|
}
|
|
|
|
static id __nullable testFailIgnoringError(id <ErrorTest> __nonnull testObj) {
|
|
return [testObj failAndReturnError:NULL];
|
|
}
|
|
|
|
#pragma clang assume_nonnull end
|