Menu

#635 Ternary confuses message-send colon in ObjC

Future
closed
nobody
None
OC+
5
2016-07-20
2015-03-12
Scott Bilas
No

Given this code:

x = [NSString str:path];
x = [NSString strFormat:@"Data/%s", path];
x = path[0] == '/' ? path : "abc";
x = path[0] == '/' ? [NSString str:path] : [NSString strFormat:@"Data/%s", path];

And an empty config, I expect to get unchanged output, but instead I get this:

x = [NSString str:path];
x = [NSString strFormat:@"Data/%s", path];
x = path[0] == '/' ? path : "abc";
x = path[0] == '/' ?[NSString str : path] :[NSString strFormat:@"Data/%s", path];

...with an error: 'unexpected colon in col 42 n-parent=NONE c-parent=OC_MSG l=0 bl=0'

Looking at the debug output, it seems that the message-send colon in the fourth line is getting picked up as a COND_COLON rather than a OC_COLON.

3 Attachments

Discussion

  • Mihai Popescu

    Mihai Popescu - 2016-07-15

    This issue can be closed.

     
  • Guy Maurel

    Guy Maurel - 2016-07-20
    • status: open --> closed