Array of Nested Type: Why Does the Compiler Complain?

后端 未结 3 1564
花落未央
花落未央 2020-12-07 03:43
class ClassA {
    class ClassB {
    }
}
let compiles: [ClassA.ClassB]
let doesNotCompile = [ClassA.ClassB]()

Playground execution failed: MyPlayg

3条回答
  •  难免孤独
    2020-12-07 04:02

    I don't know the reason why the shorthand syntax does not work. However the compiler seems to like the extended syntax

    let list = Array()
    

提交回复
热议问题