Skip to content

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
Azoy added a commit to Azoy/swift that referenced this pull request Aug 27, 2025
[AST & Runtime] Correctly mangle extended existentials with inverse requirements
al45tair pushed a commit to al45tair/swift that referenced this pull request Oct 17, 2025
[AST & Runtime] Correctly mangle extended existentials with inverse requirements
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