On Feb 23, 2015, at 11:52 , Kyle Sluder <k...@ksluder.com> wrote:
> 
> So the type of
> foo?.lowercaseString is String?.

Yes, I agree, so the OP’s *original* error message was correct, but the 
question is what is the type of ‘foo?.lowercaseString!’, and that depends on 
the precedence of the “!” operator. 

The actual error messages seem to indicate it’s associating tightly with 
‘lowercaseString’, in which case the source code is incorrect and the error 
messages are all correct.

> And either way, the fixit diagnostic is broken.

Yes, I agree with that, too. If the tight association of “!” is correct, the 
fixit needs to insert parentheses.

FWIW, I think the whole thing is confusing because the internal “?” operator 
has a local effect (changing the type of the sub-expression to its left) and a 
global effect (changing the type of the whole expression). The type of ‘a?.b’ 
is ‘B?', isn’t it? That’s a conceptual trap for the unwary, I think.



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to