It's just a hole in the language. After all, the [Type]
syntax is just syntactic sugar; as you rightly say, if you use the real syntax with Array<Type>
, or use [Type]
but not as a constructor, there's no problem. You can also work around it with type alias:
struct Struct1 {
struct Struct2 {
var name: String?
}
}
typealias Struct2 = Struct1.Struct2
var struct2Array = [Struct2]()