Xcode Autocomplete adds already existing Keywords for protocol conformance and subclasses in Swift

Originator:alex
Number:rdar://18110649 Date Originated:23-Aug-2014
Status:Duplicate/16738036 Resolved:
Product:Developer Tools Product Version:Xcode 6 beta-6
Classification:Bug Reproducible:
 
Summary:
The autocompletion for adding methods of protocols or superclasses to a class is not context-sensitive and does not respect already typed keywords like func

Steps to Reproduce:
1. Create a Protocol like the following
protocol A {
	func method()
}

2. Create a Class that shall conform to this protocol. e.g.
class B: A {
}

3. Type func meth inside the classes body
4. Xcode Autocompletion suggests to autocomplete meth to method()
5. Accept the Autocompletion
6. Xcode replaces meth with 
func method() {
	<#code#>
}
7. The now existing class body is as follows
class B: A {
	func func method() {
		<#code#>
	}
}

Expected Results:
Xcode should detect that func was already typed and only replace meth with method() {}

Actual Results:
Xcode adds a second func keyword to the method declaration and the file does not compile anymore

Version:
Xcode 6.0 (6A280e)

Notes:
Workaround: Simply delete the additional keywords or start by typing the method name and not func

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!