the swift parts can't be nicely encapsulated in the compat file because it lags proper target version compile time checks. Fixes #15292