mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Bitcast the AnyObject result to AnyObject?, then call our new helper function, so that we can handle nils without choking. Fixes rdar://problem/27874026.
37 lines
635 B
Objective-C
37 lines
635 B
Objective-C
#import "Appliances.h"
|
|
|
|
@implementation APPRefrigerator
|
|
-(instancetype)initWithTemperature:(double)temperature {
|
|
self = [super init];
|
|
if (self) {
|
|
self->_temperature = temperature;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
-(id)copyWithZone:(NSZone *)zone {
|
|
return [[APPRefrigerator alloc] initWithTemperature: self.temperature];
|
|
}
|
|
@end
|
|
|
|
@implementation APPHouse
|
|
-(instancetype)init {
|
|
self = [super init];
|
|
if (self) {
|
|
self->_fridge = [[APPRefrigerator alloc] initWithTemperature:50];
|
|
}
|
|
return self;
|
|
}
|
|
@end
|
|
|
|
@implementation APPManufacturerInfo
|
|
@end
|
|
|
|
@implementation APPBroken
|
|
|
|
- (id _Nonnull)thing {
|
|
return (id _Nonnull)nil;
|
|
}
|
|
|
|
@end
|