Xcode 7b4 (7A165t): Obj-C: Compiler does not warn about mismatch of NSArray<SomeClass *> and a literal-initialization with different classes

Originator:raise.rescue
Number:rdar://22113776 Date Originated:03-Aug-2015 03:52 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7b4 (7A165t)
Classification:UI/Usability Reproducible:Always
 
Summary:
Given this line
    NSArray <UIView *> *array = @[@""];
the compiler should warn that the array on the right hand side does not meet the generic-requirements of the array-variable. I know that this may be much harder to analyze when the assignment is not also the initialization of the array, but the compiler should be able to catch this simple case. Other cases, where the assignment may happen in different branches of the app should be catched by the analyzer.

Steps to Reproduce:
Compile the attached program that contains the mentioned line of code - currently, it compiles without any issues. The project-settings are the default ones of a newly created Xcode 7-project.

Expected Results:
There should be a compiler-warning to catch the type-mismatch, and the analyzer should be capable of recognizing more complex mismatches.

Actual Results:
No compiler-warning, no analyzer-result.

Regression:
Describe circumstances where the problem occurs or does not occur, such as software versions and/or hardware configurations.

Notes:
Provide additional information, such as references to related problems, workarounds and relevant attachments.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!