Runtime demangler support for pack expansions [5.9] #67181
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description: Type witnesses in witness tables are represented as a mangled string which is passed in to the runtime demangler. The type witness can reference the generic parameters of the conforming type in the general case; if any of these generic parameters are packs, the type witness can contain pack expansions. Implement support for pack expansion types in the runtime demangler, when they appear inside tuples, function type parameter lists, and nominal type generic argument lists.
Scope of the issue: If you conform a variadic nominal type to a protocol and witnessed an associated type requirement with a type involving a pack expansion, you would crash. Also, the Swift runtime exports public entry points for calling into the demangler from framework code.
Risk: Only affects code that uses parameter packs, other than a small refactoring to handling of tuple labels.
Radar: rdar://111694735
Reviewed by: @hborla