Xcode suggests incorrect function renaming

Originator:neilkimmett
Number:rdar://27079603 Date Originated:29-Jun-2016 03:17 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-beta (8S128d)
Classification:Serious Bug Reproducible:Always
 
Summary:
I use a 3rd party library called PureLayout (https://github.com/PureLayout/PureLayout) to simplify programmatic auto layout code. It is written in Objective C and includes functions like

- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView

Swift 3 correctly imports this as
func autoMatch(_ dimension: ALDimension, to toDimension: ALDimension, of otherView: UIView) -> NSLayoutConstraint

However at the callsite Xcode’s Fix It suggested an incorrect replacement.

Steps to Reproduce:
Have an Objective C function named as above and run the Swift 3 migrator

Expected Results:
Callsites of the function in Swift would be correctly updated to
autoMatch(…, to: …, of: …)

Actual Results:
The following problems occurred when running the Swift 3 migrator:
- the migrator didn’t automatically change all my callsites of these functions
- Xcode’s Fix It suggestion (post-migration) suggested an incorrect replacement:
“Replace autoMatch” with “autoMatchtoof”
- upon clicking Fix It my code got replaced with
autoMatchwidthDimension(.…, toDimension: …, ofView: …)

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!