Swift 2 seed 1: It’s not possible to create an empty array of nested structs using shorthand syntax
| Originator: | jj | ||
| Number: | rdar://21432358 | Date Originated: | 18-Jun-2015 01:46 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-beta (7A120f) |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
It’s not possible to create an empty array of nested structs using shorthand syntax for arrays.
Steps to Reproduce:
Open a playground or Xcode project and use the following code:
/////
struct A {
struct B {
}
}
var foo0 : Array<A.B> = [] // OK
var foo1 = Array<A.B>() // OK
var foo2 : [A.B] = [] // OK
var foo3 = [A.B]() // Error: Invalid use of ‘()’ to call a value of non-function type ‘[A.B.Type]’
///
Expected Results:
foo3 would contain an empty array of type [A.B]
Actual Results:
Compiler error: Error: Invalid use of ‘()’ to call a value of non-function type ‘[A.B.Type]’
Regression:
Also happens with Xcode 6.3.2
Notes:
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!