Skip to content

AST: Add workaround for incorrect mangling of conditional conformances with pack requirements #77463

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 1 commit into from
Nov 8, 2024

Conversation

slavapestov
Copy link
Contributor

I added commit 7eecf97 a while ago to fix a newly-added assertion failure that came up, however this had the inadvertent side effect of changing symbol mangling and ASTPrinter behavior.

The problem in both instances was that we would incorrectly return certain requirements as unsatisfied when really they are satisfied.

There is nothing to fix in the ASTPrinter, because printing redundant requirements does not change the generic signature of the extension; they are simply dropped. I added a test to exercise the new behavior showing that the requirements are dropped.

As for the mangler, the fix introduced an ABI break, because the symbol name of a conformance descriptor includes its conditional requirements, so we must preserve the redundant requirements forever.

I'm plumbing down a flag to isRequirementSatified() to preserve compatibility with the old behavior where we would mangle these redundant requirements. No other callers should pass this flag, except for the mangler.

Fixes rdar://139089004.

…s with pack requirements

I added commit 7eecf97 a while ago
to fix a newly-added assertion failure that came up, however this
had the inadvertent side effect of changing symbol mangling and
ASTPrinter behavior.

The problem in both instances was that we would incorrectly return
certain requirements as unsatisfied when really they are satisfied.

There is nothing to fix in the ASTPrinter, because printing redundant
requirements does not change the generic signature of the extension;
they are simply dropped. I added a test to exercise the new behavior
showing that the requirements are dropped.

As for the mangler, the fix introduced an ABI break, because the
symbol name of a conformance descriptor includes its conditional
requirements, so we must preserve the redundant requirements forever.
The IRGen test has some examples of manglings that are incorrect but
must be preserved.

I'm plumbing down a flag to isRequirementSatified() to preserve
compatibility with the old behavior where we would mangle these
redundant requirements. No other callers should pass this flag,
except for the mangler.

Fixes rdar://139089004.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@slavapestov slavapestov merged commit fcd6985 into swiftlang:main Nov 8, 2024
3 checks passed
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.

1 participant