For some reason, having a nested class with a nested enumeration called Typedosen't plays well with a fast compiler.
class A {
class B {
enum Type {
case One
case Two
}
let myC: Type
init(myC: Type) {
self.myC = myC
}
}
func getB(myC: B.Type) -> B {
return B(myC: myC)
}
}
let a = A()
let b = a.getB(.Two)
There are two errors in the above code: 'A.B.Type' is not convertible to 'A.B.Type'and 'A.B.Type.Type' does not have a member named 'Two'.
The following cases work:
class B out class Alet b = A.B(myC: .Two)enum C instead enum Type
Is this a bug in Swift or is this the intended behavior? Is a Typereserved name that we should not use?
source
share