Inserting a key of the wrong type into an NSMutableDictionary does not warn in Objective-C
| Originator: | heath.borders | ||
| Number: | rdar://25060179 | Date Originated: | 09-Mar-2016 10:16 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Version 7.2 (7C68) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
Provide a descriptive summary of the issue.
Steps to Reproduce:
Compile the following:
NSMutableDictionary<NSString *, NSString *> *stringsByString = [NSMutableDictionary new];
stringsByString[@"1"] = @1;
[stringsByString setObject:@1 forKey:@"1"];
stringsByString[@2] = @"2";
[stringsByString setObject:@"2" forKey:@2];
Expected Results:
All setObject:forKey: and setObject:forKeyedSubscript: calls should warn.
Actual Results:
Only the calls with non-matching value types warn.
Regression:
Notes:
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!