Tuple pattern element type constrainting bug
| Originator: | an00na | ||
| Number: | rdar://22177771 | Date Originated: | 06-Aug-2015 04:35 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Swift 2.0 beta 5 |
| Classification: | Other Bug | Reproducible: | Always |
The Swift Book - Tuple Pattern: “You can constrain a tuple pattern to match certain kinds of tuple types by using type annotations. For example, the tuple pattern (x, y): (Int, Int) in the constant declaration let (x, y): (Int, Int) = (1, 2) matches only tuple types in which both elements are of type Int. To constrain only some elements of a tuple pattern, provide type annotations directly to those individual elements. For example, the tuple pattern in let (x: String, y) matches any two-element tuple type, as long as the first element is of type String.” However, the syntax of individual element constraining does not work as expected. In real effect `x` is treated as the element name while `String` is treated as the variable. Sample code: http://cl.ly/3n0b0k1e2B3a
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!