Allow generic arguments on an extension in Swift
Originator: | n.vanhoorn | ||
Number: | rdar://20570613 | Date Originated: | 16-Apr-2015 05:21 PM |
Status: | Open | Resolved: | |
Product: | Developer Tools | Product Version: | Xcode 6.3 (6D570) |
Classification: | Enhancement | Reproducible: | Always |
Summary: It would be nice to be able to extend certain instances of generic types. For example: extension Dictionary<String,Int> { func test() { } } and let the method test() only be available on instances of dictionary of the type Dictionary<String,Int>. Steps to Reproduce: Paste the above code in a Playground Expected Results: Succesful compilation Actual Results: Compiler error: Playground execution failed: Reflection.playground:1:1: error: generic arguments are not allowed on an extension extension Dictionary<String,Int> { ^ ~~~~~~~~~~~~
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!