Extensions in Swift should not allow overriding a generic type

Originator:info
Number:rdar://19839003 Date Originated:14-Feb-2015 04:09 PM
Status:Open Resolved:
Product:Developer Tools Product Version:1.1
Classification:Enhancement Reproducible:Always
 
Summary:
When adding an extension to a type in Swift, one can repeat a generic type, but this can result in really confusing error messages.

Steps to Reproduce:
Try to compile the following code:

struct G<T> {}

extension G {
	static func g<T>() -> G<T> {
		return G()
	}
}

Expected Results:
Error message: “Function cannot redefine generic type ’T’”.

Actual Results:
Unhelpful and confusing error message: “'T' is not identical to ’T’”

Regression:
N/A

Notes: 
The code is obviously incorrect. One shouldn’t define <T> in g() again. But it would be nice to have a more accurate error message.

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!