Xcode 9.0 (9A235): comment after break statement changes auto-indenting

Originator:igeek1
Number:rdar://34464828 Date Originated:15-Sep-2017 02:49 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 9.0 (9A235)
Classification:UI/Usability Reproducible:Always
 
Summary:
If you put a comment after a break statement in a switch, it causes Xcode to auto-indent the line differently than without a comment.

Steps to Reproduce:
1. Copy and paste the following code into a Swift file in Xcode, or open the attached playground:

// Select all and use Control-I to apply auto-indenting in Xcode 9

// This switch statement looks OK
switch true {
case true:
    break
case false:
    break
}

// this switch statement is
switch false {
case true:
break // a comment causes the break to not auto-indent correctly
case false:
    break // but not in this case
}

// END CODE BLOCK

2. Select all of the code.
3. Type Control-I to auto-indent the code. Nothing should change, because the code is already formatted the way Xcode likes to format it.

Expected Results:
All of the break statements are indented from their parent case statements.

Actual Results:
The first break with a comment is outdented. The second break is not outdented.

Version:
Xcode 9.0 (9A235) 

Notes:
Attached playground also uploaded at https://cl.ly/mXRV

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!