Convert to Modern Objective-C does a partial convert with a common NSDictionary
| Originator: | felipekellermann | ||
| Number: | rdar://12428166 | Date Originated: | 04-Oct-2012 01:29 AM |
| Status: | Closed | Resolved: | |
| Product: | Developer Tools | Product Version: | 4.5.1 |
| Classification: | Enhancement | Reproducible: | Always |
04-Oct-2012 01:29 AM Felipe Kellermann:
Summary:
Even though the "Convert to Modern Objective-C" feature works almost perfectly, a very common syntax of dictionary creation fails to fully convert to the "Modern Objective-C". The syntax is NSDictionary's +dictionaryWithObjects:forKeys (and -dictionaryWithObjects:forKeys init method).
Steps to Reproduce:
Create a project and add this simple code (to be converted):
NSDictionary *dict = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"1", @"2", nil] forKeys:[NSArray arrayWithObjects:@"A", @"B", nil]];
Expected Results:
NSDictionary *dict = @{ @"A" : @"1", @"B" : @"2" };
Actual Results:
NSDictionary *dict = [NSDictionary dictionaryWithObjects:@[@"1", @"2"] forKeys:@[@"A", @"B"]];
This is quite clearly a partial convert.
Regression:
N/A.
Notes:
While this is not even critical, it confuses people and actually misses the convert of one of the ugliest constructions with the old syntax which is the arrayWithObjects:forKeys:.
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!