Last active
December 17, 2015 05:13
-
-
Save nsforge/73fa1d9c77808440a7a7 to your computer and use it in GitHub Desktop.
Lack of warnings on [[self alloc] init] type errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface MyClass : NSObject | |
@end | |
@implementation MyClass | |
+ (void)myMethod | |
{ | |
NSArray *x = [[self alloc] init]; // This _doesn't_ throw a warning, despite +alloc and -init both being declared as instancetype | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[[MyClass alloc] init]
correctly throws a warning in this scenario, butself
seems to make the return types be treated asid
.