Swift 2 converter does not properly convert first method parameter if it has a default value

Originator:fluidsonic
Number:rdar://21669568 Date Originated:2015-07-03
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7 Beta 2
Classification:Other Bug Reproducible:Always
 
Summary:
In Swift 1, a method like "func test(parameter: Int = 0)" implicitly means "func test(#parameter: Int = 0)".
When converting this method to Swift 2 using the syntax converter then the external parameter name is not added automatically. Instead the converter erroneously removes the parameter name from all method calls.

Steps to Reproduce:
1. Copy the attached code into a Playground.
2. Use "Convert > To Latest Swift Syntax"

Expected Results:
The first parameter of the test method should have the external name "parameter", i.e. "func test(parameter parameter: Int = 0)".
The method call should stay "Test().test(parameter: 2)"

Actual Results:
The first parameter of the test method loses its external name "parameter", i.e. "func test(parameter: Int = 0)".
The method call is erroneously converted to "Test().test(2)"


Attached file:

class Test {

	func test(parameter: Int = 0) {
		//
	}
}

Test().test(parameter: 2)

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!