How can I find out what language features (not APIs) are available on a particular OS Version?

It's relatively easy to find out what APIs are available on a particular OS version by searching for @available (I think a SwiftModule file for a particular library is probably the place to do this?). But what about runtime features?

The changelog.md file for the Swift repo doesn't seem to have a comprehensive list in it. My initial approach to solve this myself was to try to find out where the error message Runtime support for parameterized protocol types is only available in iOS 16.0.0 or newer appears in the Swift language source, assuming that if I find other uses, I'll be able to get the full list. Unfortunately I wasn't able to find it; all I got were some tests. I assume that the string for this error is parameterized somehow, but even searching for likely substrings has turned up nothing so far. Is there a list out there? Is there something I can search for to try to compile this information?

I'm not sure if this is definitive or exactly how to do the mapping from runtime/compiler version to OS version, but I think the "FeatureAvailability.def" file might be of interest – here is where it looks like the parameterized existential availability might be defined.

3 Likes

Thanks, this is almost exactly what I need. Also a very interesting read, I had no idea that LayoutStringValueWitnesses even existed.

1 Like

To digress a bit on this point... you're correct that the error is parameterized (as many are), and this one specifically seemed a bit more convoluted to track down than most. In case it's of any help in the future, some strategies that I've found work fairly well for this sort of thing:

  1. Grep for substrings or regexes with wildcards. Many of the diagnostic strings are split across multiple lines and have substitutions, so you sometimes have to avoid searching for things that are too long, or guess where the format string substitutions likely are.
  2. Compile with -debug-diagnostic-names to get the diagnostic id associated with the error/warning and then search for that.
  3. Ask your favorite LLM-based tool to help track it down.