Skip to content

IRGen: Fix assertion failure with typed throws #80273

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
Mar 25, 2025

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Mar 25, 2025

This fixes a regression from f6e7c16. The mapTypeIntoContext() call in visitFullApplySite() was not necessary because the type in question is already fully substituted and should no longer contain type parameters.

However, it can contain archetypes, which is what caused mapTypeIntoContext() to assert. Indeed, this case where the return type is generic but still loadable wasn't covered by our test suite.

(I believe the other places where mapTypeIntoContext() was introduced in that commit are correct, because there we're dealing with the interface type of the current function, which can contain type parameters.)

The mapTypeIntoContext() call in visitFullApplySite() was not
necessary.

The type in question is already fully substituted and should
no longer contain type parameters.

However, it can contain archetypes, which is what caused
mapTypeIntoContext() to assert.

Indeed, this case where the return type is generic but still
loadable wasn't covered by our test suite.

- Fixes swiftlang#80020.
- Fixes rdar://147051717.
@slavapestov slavapestov requested a review from rjmccall as a code owner March 25, 2025 16:35
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

CC @drexin

@slavapestov slavapestov enabled auto-merge March 25, 2025 16:39
Copy link
Contributor

@drexin drexin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@slavapestov slavapestov merged commit d23adf4 into swiftlang:main Mar 25, 2025
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.

6.1 nightly crashes on "Assertion `!type.hasPrimaryArchetype()' failed" with typed throws
2 participants