arphaman added a comment. @rjmccall Do you think that the rules for the return types in overridden methods that return `instancetype` should be strengthened first? For example, if we have the following code:
@interface Unrelated - (void)method:(int)x; @end @interface CallsSelfSuper: NSObject + (void) target; - (void) method:(CallsSelfSuper *)x; @end @implementation CallsSelfSuper + (void) target { [[self alloc] method: 12]; // Can't assume 'method' is CallsSelfSuper's 'method' declaration unless we guarantee that OverrideAlloc's alloc actually returns `instancetype` and not id. } @end @interface OverrideAlloc: CallsSelfSuper @end @implementation OverrideAlloc + (id) alloc { return [NSString alloc]; } @end We can't really make any assumptions about what `[self alloc]` will return. But in my opinion we could assume that `[self alloc]` will return a `CallsSelfSuper *` if we could ensure that methods that override methods that return `instancetype` will compile only if they return `instancetype` type as well. Repository: rL LLVM https://reviews.llvm.org/D36790 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits