Swift 1.2b3: “could not find member” with property getter on new line

Originator:rix.rob
Number:rdar://20238557 Date Originated:20-Mar-2015 10:32 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-beta (6D543q)
Classification:Other Bug Reproducible:Always
 
Summary:
Using a property getter on a separate line from the receiver results in “could not find member 'blah'”. This works fine for methods, leading me to think this is a weird parsing bug and it’s looking for a static property `blah` on the enclosing type, or something like that.


Steps to Reproduce:
1. Write this code:
[0]
	.count



Expected Results:
I expected that to compile, resolving to the value 1: Int.


Actual Results:
error: could not find member 'count'


Regression:
According to @bavarious this occurs in Swift 1.1 as well and is therefore not a (recent) regression.

You can work around it with this absurdity involving parentheses:

([0]
	).count


Notes:
I run into this semi-regularly with properties like `count` on `Array` and `array` on `Lazy*View`, but hadn’t tracked it down to being just a newline thing; hat tip to @bavarious for the reduction.

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!