Skip to content

[AST & Runtime] Correctly mangle extended existentials with inverse requirements #81365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 12, 2025

Conversation

Azoy
Copy link
Contributor

@Azoy Azoy commented May 7, 2025

Currently, the ASTMangler has 2 ways of emitting an extended existential mangling: 1. if the extended existential is parameterized, it will eagerly try to symbolically reference the extended shape or 2. just as a flat string. For extended existentials that have inverses, it was taking the 2nd option. The runtime does not currently have the capabilities to decode an extended existential without a shape referenced in the type mangling, so when attempting to create metadata for something like any ~Copyable it would fail spectacularly.

Add a method on existential layouts called needsExtendedShape which should be single point of truth whether or not the compiler should emit a shape into binaries for such existentials.

Also, while we're at it, since we have access to extended existential metadata for these things now, we should implement printing of these metadata. So also included in this patch is the runtime building of the demangling tree from the metadata which includes generalization argument substitution.

Resolves: rdar://150219645

@Azoy
Copy link
Contributor Author

Azoy commented May 7, 2025

@swift-ci please test

@Azoy
Copy link
Contributor Author

Azoy commented May 8, 2025

@swift-ci please test

@Azoy
Copy link
Contributor Author

Azoy commented May 8, 2025

@swift-ci please test

@Azoy
Copy link
Contributor Author

Azoy commented May 9, 2025

@swift-ci please test Windows

@Azoy Azoy merged commit 9e24563 into swiftlang:main May 12, 2025
5 checks passed
@Azoy Azoy deleted the my-existentials branch May 12, 2025 20:21
hamishknight added a commit to hamishknight/swift that referenced this pull request May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants