Converting to modern syntax changes behaviour

Hey guys,

I experienced a weird behaviour today from AppCode, I "blindlessly" (my mistake) converted a couple of lines to Obj-C modern syntax (AppCode showed a warning on them) including this -

(existingAccounts is a dictionary containing @"accountId" key to NSManagedObject with accountId key)

NSDictionary *existingAccountsDict = [NSDictionary dictionaryWithObjects:existingAccounts forKeys:[existingAccounts valueForKey:@"accountId"]];

That specific line was converted to -

 
NSDictionary *existingAccountsDict = @{[existingAccounts valueForKey:@"accountId"] : existingAccounts};

Which creates a different dictionary, the first one actually creates a dict with accountId values pointing to existingAccounts array objects, the second one creates a dictionary with one key (the existingAccounts array).
Is this a bug or a wanted behaviour?

Thanks,
Nimrod.

2 comments
Comment actions Permalink

Hello Nimrod.

This is obviously a bug - thanks for reporting it. You may track its progress at https://youtrack.jetbrains.com/issue/OC-10653

0
Comment actions Permalink

Thanks,

Will follow up on that.

0

Please sign in to leave a comment.