Refactor > Extract All Occurrences also grabs comment

Originator:dtweston
Number:rdar://34981275 Date Originated:13-Oct-2017 10:57 AM
Status:Open Resolved:
Product:Developer Tools Product Version:9.1 beta 2
Classification:Other Bug Reproducible:Always
 
Summary:
When I use Extract All Occurrences for the first part of a line that has a comment above it, the extracted portion includes the comment for some reason (the selected portion does not encompass the comment)

Steps to Reproduce:
1. Create some lines of code that include a common prefix
2. Add a comment above each line.
3. Select the common prefix and choose Refactor > Extract All Occurrences
4. Enter any new name

Expected Results:
The comment above the selected prefix should remain untouched and not be copied into the new refactored line.

Actual Results:
The comment is left alone on its original line, however, it is also placed in the code where the common prefix is extracted to. The code compiles as written, but it is very incorrect.

Version:
9.1 beta 2

Notes:
For example, the following code:

        // Disable auto update.
        BITHockeyManager.shared().isUpdateManagerDisabled = true
        
        // Set Hockey App Delegate in order to get crash reports etc.
        BITHockeyManager.shared().delegate = AppExtensionHockeyManagerDelegate.sharedInstance
        
        // Auto-send crash reports to Hockey App.
        BITHockeyManager.shared().crashManager.crashManagerStatus = BITCrashManagerStatus.autoSend
        
        // Start Hockey App.
        BITHockeyManager.shared().start()
        
        // Authenticate the hockey app installation
        BITHockeyManager.shared().authenticator.authenticateInstallation()

Also see attached QuickTime recording.

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!