[Swift] Parse issues with assignment operators

Number:rdar://17301831 Date Originated:6/13/14
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:
All or most of the various assignment operators (=, +=, -=, *=, /=) currently have very strict rules about their surrounding whitespace. The operators must either have no whitespace separating them from either operand, or whitespace between them and both operands. Having whitespace only between the operator and one operand, but not the other, results in a compiler error.

Steps to Reproduce
1. Create a new Playground in Xcode 6.
2. Enter the following:
var i=0
i = 2
i =2
i= 2

i +=2
i+= 2
i += 2

i -=2
i-= 2
i -= 2

i *=2
i*= 2
i *= 2

i /=2
i/= 2
i /= 2

(or load the attached playground)

Expected Results
This code should be valid and compile without error.

Actual Results
Several lines produce various compiler errors:
- For the = operator, when there is whitespace on one side of the operator but not the other, the compiler complains "Prefix/Postfix '=' is reserved."
- In the same situation for the other operators, the compiler complains "Consecutive statements on a line must be separated by ';'"


Xcode Version
Xcode 6 Beta 1

Additional Notes


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!