[Swift] Enum must be fully qualified if single arg to variadic function
| Originator: | AustinZheng | ||
| Number: | rdar://19702040 | Date Originated: | 03-Feb-2015 |
| Status: | Duplicate of 18083599 | Resolved: | |
| Product: | Developer Tools | Product Version: | |
| Classification: | Reproducible: |
Summary:
Say we have a function with a variadic argument of enum type. If we pass in only one argument, the enum must be fully qualified. If we pass in more than one argument, the enums don't have to be fully qualified.
The compiler should not treat a single T passed into a function with a T... vararg parameter as a [T], which seems to be the cause of this error.
An annotated sample project demonstrating this has been enclosed.
Steps to Reproduce:
1. Define an enum:
enum MyEnum { case Foo, Bar, Baz }
2. Define a function taking a variadic parameter of that enum type:
func variadicFunc(x: MyEnum...) { /* do stuff */ }
3. Try to call the function with the non-fully-qualified enum:
variadicFunc(.Foo)
Expected Results:
This code should compile, and act identically as "variadicFunc(MyEnum..Foo)", which does compile and work as expected.
Actual Results:
The code does not compile, with the error "'(MyEnum...).Type" does not have a member named 'Foo'"
Version:
Xcode 6.1.1 (6A2008a), OS X 10.9.5
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!