Files
swift-mirror/test/Inputs/ObjCBridging/Appliances.m
Joe Groff 484429daa0 SILGen: Bridge id to Any using a stdlib helper.
Bitcast the AnyObject result to AnyObject?, then call our new helper function, so that we can handle nils without choking. Fixes rdar://problem/27874026.
2016-08-18 15:09:55 -07:00

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