SE-0396: Conform Never to Codable

Answering question about generics

This is how things work in Rust and C++, but not in Swift. Type definitions are generated at run time for each combination of generic parameters your code actually uses. In some cases the compiler can do that work ahead of time, or will make assumptions about the resulting type that the runtime will build, but the language model is not allowed to depend on that. That doesn't mean there are no special cases—Optional is very special at both compile time and run time—but it's not as simple as the compiler seeing Result<Foo, Never> and going "oh, okay, I can omit the enum tag altogether for this one".

13 Likes