Until the 10.9 SDK and the LLVM 5 compiler the following would not produce a warning or error:

NSDictionary *blah = [NSArray array];

The LLVM 5 compiler reports this as a warning.

previous SDKs make declarations like:

+ (id)array;

In the new SDK we now have a new keyword instancetype that we can use for return types:

+ (instancetype)array;

instancetype is a contextual keyword. Subclasses do not need to redeclare “instancetype” methods. The compiler matches the return type to the receiver.

If we have the following declaration:

@interface Foobar : NSArray

then the following:

NSDictionary *myVar = [Foobar array];

Will produce a incompatible pointer type warning. The compiler views the returned object to be of type as:

Foobar *


NSArray *

In either case these are incompatible types for NSDictionary *.