Swift 2 converter does not always convert "count" correctly on string variables

Originator:fluidsonic
Number:rdar://21669358 Date Originated:2015-07-03
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7 Beta 2
Classification:Other Bug Reproducible:Always
 
Summary:
We upgraded a larger project to Swift 2 using the "Convert > To Latest Swift Syntax" feature.
Occasionally the converter converts "count(stringVariable)" to "stringVariable.count" instead of "stringVariable.characters.count".
This seems to happen when "stringVariable" became an optional due to optionality changes in iOS 9.

Steps to Reproduce:
1. Put the following code in a Playground:

let string: String?
count(string)

2. Run "Convert > To Latest Swift Syntax".

Expected Results:
Should convert the code to the following:

let string: String?
string.characters.count

And let me fix the optionality issue (due to optionality changes in new iOS SDK) later.

Actual Results:
let string: String?
string.count

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!