Xcode 7.2: Swift: Miss-leading Fix-It when passing a `let` array as a C pointer array

Originator:dieter.komendera
Number:rdar://24015836 Date Originated:28-Dec-2015 04:00 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.2 (7C68)
Classification:UI/Usability Reproducible:Always
 
Summary:
This generates a miss-leading fix-it:

import MapKit

let coords = [CLLocationCoordinate2D(latitude: 48.211151, longitude: 16.365379),
	CLLocationCoordinate2D(latitude: 48.199167, longitude: 16.351016)]
let polyline = MKPolyline(coordinates: &coords, count: coords.count)

Produces: '&' used with non-inout argument of type 'UnsafeMutablePointer<CLLocationCoordinate2D>'

The fix-it suggests to remove the & in the MKPolyline constructor call, but the correct fix is to make coords a ‘var’ instead of a ‘let’

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!