I just had a closer look at the generic types (not the members), I think the reason why the compiler allowed is because it wasn‘t smart enough to catch the complexity of this pattern. I also think this smells like a derivation of CRTP which can be mind bending but still valid. Take this valid Swift 5 for example.
class G<T> {
class S: G<S>
var t: T
init(_ t: T) {
self.t = t
}
}
}
let a = G<Int>.S(42)
let b: G<G<Int>.S> = a // works but mind bending at first glance
I‘m on my iPad so I can‘t test your original example in Swift 5. CRTP was mostly implemented with Swift 5. I said mostly, because there is a potential CRTP pattern in protocols, which is currently rejected by the compiler.