Skip to content

[6.0] [Demangle-to-AST] Match invertible-generics extensions with no signature #72680

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

Conversation

DougGregor
Copy link
Member

Explanation: Correctly handle demangling extensions with no mangled generic signature to generic types with invertible constraints.
Issue: rdar://125515645
Original PR: #72644
Risk: Low. The change only has an impact on demangling to AST types when invertible protocols are involved.
Testing: New tests.

Introduce a predicate that determines when a given extension corresponds
to what one would get by existing the nominal type without spelling out
any constraints. This differs from the notion of a "constrained
extension" when the nominal type suppresses conformances on any of its
generic parameters, e.g.,

    struct X<T: ~Copyable> { ... }

    // doesn't spell out any constraints, but is constrained because it
    // implicitly adds T: ~Copyable.
    extension X { ... }

    // does spell out constraints, but is not constrained because the
    // generic signature matches that of X.
    extension X where T: ~Copyable { }

Use this predicate when demangling a name to metadata, because name
mangling for extensions suppresses the generic signature for cases
where one "doesn't spell out any constraints."

(cherry picked from commit 994e342)
@DougGregor DougGregor requested a review from a team as a code owner March 28, 2024 20:50
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor merged commit b80e169 into swiftlang:release/6.0 Mar 29, 2024
@DougGregor DougGregor deleted the demangle-extensions-without-written-requirements-6.0 branch March 29, 2024 04:18
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