I think it's worth spelling out what you mean by "compile" here. I've been making the compiler more aware of code that is unreachable at runtime due to un-availability constraints. For example, a function that is @available(macOS, unavailable)
is unreachable at runtime[1] on macOS and can therefore either be omitted in the resulting binary (or at least stubbed out if it still needs to exist for linking purposes). Taking advantage of this knowledge, we can get some of the best of both worlds: we still type check code that is unreachable at runtime, since it's not conditionally compiled, but we don't do any code generation for it so the size impact is minimized. This helps avoid a problem with conditional compilation where you can't be sure that code you are changing will still compile in other build configurations without actually building in those configurations. Embedded Swift takes advantage of this feature to keep various declarations available for type checking, while not allowing those unavailable-in-embedded declarations to actually wind up in the final binary.
Modulo various compiler bugs that defeat availability checking, or the owner of a resilient library retroactively marking a previously available function as unavailable. â©ïž