Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RoyG

macrumors newbie
Original poster
Jul 24, 2011
20
0
This is what I get:

xcodeGet.png


A BOUNDless expansion of the NSRect bounds.

This is what I Expect:

xcodeExpect.png


To access the NSRect values 'origin' and 'size'.

So what is going on here? A bug in Xcode, or me being plain stupid?

In the boundless expansion of 'bounds', there is no 'origin' or 'size' to spot.
 
Last edited:

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,558
6,058
It looks like you're using the identifier bounds multiple times in that scope to refer to different things... That may be confusing Xcode's autocomplete.
 

RoyG

macrumors newbie
Original poster
Jul 24, 2011
20
0
It looks like you're using the identifier bounds multiple times in that scope to refer to different things... That may be confusing Xcode's autocomplete.

Oh no, that is not what happens. I have declared 'NSRect bounds' only once in the whole project, and that is within the scope you are seeing in that picture.

It seems actually to be a bug in Xcode. It seems Xcode gets confused when I skipped one of the placeholders to fill in values for a method. I filled in dummy values for those fields, and then I got the result I expected.

Under no circumstances should bounds refer to itself in this way, I could type 'bounds.bounds.bounds.bounds.bounds...' ad infinitum, and Xcode would not suggest anything else for me.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
Under no circumstances should bounds refer to itself in this way, I could type 'bounds.bounds.bounds.bounds.bounds...' ad infinitum, and Xcode would not suggest anything else for me.

Can you hear me play the world's saddest song on the world's smallest violin? :D
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,558
6,058
Oh no, that is not what happens. I have declared 'NSRect bounds' only once in the whole project, and that is within the scope you are seeing in that picture.

It seems actually to be a bug in Xcode. It seems Xcode gets confused when I skipped one of the placeholders to fill in values for a method. I filled in dummy values for those fields, and then I got the result I expected.

Under no circumstances should bounds refer to itself in this way, I could type 'bounds.bounds.bounds.bounds.bounds...' ad infinitum, and Xcode would not suggest anything else for me.

Huh - file a bug at bugreporter.apple.com
 

iSee

macrumors 68040
Oct 25, 2004
3,539
272
I've seen xcode's autocomplete get confused by syntax errors, especially ones immediately prior to were you are typing, as is the case here. I'm not quite sure I'd call it a bug, though. Autocomplete could handle this case better, so it's a good feature request.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,740
8,416
A sea of green
Try changing the local variable name to something that's not a method or property, like 'bob'.

If this solves the problem, then submit both your fail-case (bounds) and success-case (bob) in a bug-report to Apple. And be sure to tell them exactly which Xcode version it happens in.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,558
6,058
Oh no, that is not what happens. I have declared 'NSRect bounds' only once in the whole project, and that is within the scope you are seeing in that picture.

It's also the name of a method and property of self within the current scope. I'm not saying the autocomplete is valid, just pointing out where the confusion may lie.
 

RoyG

macrumors newbie
Original poster
Jul 24, 2011
20
0
It's also the name of a method and property of self within the current scope. I'm not saying the autocomplete is valid, just pointing out where the confusion may lie.

At first I was going to contest what you were saying there, but I decided to have another look, and you are right! It really slipped my mind. You are absolutely right.

That does indeed tell a bit about how autocomplete works, because it should tell me about 'origin' and 'location' too, but those are completely gone until I fill in a dummy value for the placeholder value immediately before the value that is the problem.

I have noticed before that autocomplete likes that you fill in values in order, so maybe I better make that habit.

----------

So, don't skip the placeholders then? Autocomplete is a godsend, but not infallible. Skipping the placeholders obviously breaks the autocomplete's parser logic, so ixnay on the ipskay.

Yes, skipping placeholders is definitely something that autocomplete doesn't like, and the only solution is to do as you say. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.