Skip to content

Conversation

al45tair
Copy link
Contributor

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

[AST & Runtime] Correctly mangle extended existentials with inverse requirements
@al45tair al45tair requested a review from a team as a code owner October 17, 2025 15:46
@al45tair
Copy link
Contributor Author

Explanation: This didn't get cherry picked to 6.2.0 or 6.2.1, but is in the 6.2 release branch already.
Risk: It's been on main since August, so probably low now, though originally @Azoy said medium.
Original PR: #83953
Reviewed by: @slavapestov
Resolves: rdar://150219645
Tests: Tested by an interpreter test.

@al45tair
Copy link
Contributor Author

@swift-ci please test

@tbkka
Copy link
Contributor

tbkka commented Oct 17, 2025

Is this related to #84546 ? CC: @drexin

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.

4 participants