Swift: An enum case cannot have the same name as the associated type

Originator:amber
Number:rdar://20684267 Date Originated:24-Apr-2015 09:42 AM
Status:Open Resolved:
Product:Developer Tools Product Version:1.2
Classification:Serious Bug Reproducible:Always
 
Summary:
A Swift enum case can not have the same name as the associated type it holds. For example:
public enum item {
	case Group (Group)
}

Steps to Reproduce:
1. In a playground define a new enum called testEnum ( enum testEnum { } )
2. give the enum a case called String and an associated type of String. ( case String (String) )
3. Notice that you will get an error from the compiler  ‘ Use of undeclared type ‘String’ ‘

Expected Results:
I expect to be allow to name a case based on type. In some cases an enum can serve as a type wrapper where you are using cases to determine the type it is holding, and it would be nice to name the cases accordingly.

Actual Results:
Error from compiler, name of enum is hiding the type.

Regression:
unknown.

Notes:
Provide additional information, such as references to related problems, workarounds and relevant attachments.

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!