Skip to content

AST: fix isWrittenWithConstraints #74372

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
Jun 13, 2024
Merged

AST: fix isWrittenWithConstraints #74372

merged 1 commit into from
Jun 13, 2024

Conversation

kavon
Copy link
Member

@kavon kavon commented Jun 13, 2024

Surprisingly, there are some situations where an extension can end up with fewer constraints than the extended type. The assumption that it's always more or the same number of requirements was baked-in as an assertion in this new-ish method.

I haven't figured out why that can happen in the reproducer only when using -interpret mode. It didn't trigger the assertion for me when compiling normally.

The fix is simple: check all the requirements, rather than using a short-cut.

resolves rdar://125659789 / #72719

Surprisingly, there are some situations where an extension can end up
with _fewer_ constraints than the extended type. That was baked-in as an
assertion in this new-ish method.

I haven't figured out why that can happen in the reproducer only when
using `-interpret` mode. It didn't trigger the assertion for me when
compiling normally.

The fix is simple: check all the requirements, rather than using a
short-cut.

resolves rdar://125659789 / swiftlang#72719
@kavon
Copy link
Member Author

kavon commented Jun 13, 2024

@swift-ci test

@kavon kavon requested a review from DougGregor June 13, 2024 00:21
@kavon
Copy link
Member Author

kavon commented Jun 13, 2024

@swift-ci test macOS

@kavon kavon merged commit 4517333 into swiftlang:main Jun 13, 2024
5 checks passed
kavon added a commit to kavon/swift that referenced this pull request Jun 13, 2024
kavon added a commit to kavon/swift that referenced this pull request Jun 13, 2024
kavon added a commit to kavon/swift that referenced this pull request Jun 13, 2024
This is a follow-up to clean-up swiftlang#74372

(cherry picked from commit e4ed330)
meg-gupta pushed a commit to meg-gupta/swift that referenced this pull request Jun 20, 2024
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.

Assertion failure: extReqs.size() == typeReqs.size()) in isWrittenWithConstraints.
1 participant