Files
swift-mirror/test/Interpreter/SDK/Inputs/errors.h
Jordan Rose 55b20d42d7 [test] Test invoking the ObjC entry point of a throwing method.
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/.
2016-04-11 20:06:40 -07:00

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