Skip to content

[CS] Avoid solver-allocated inputs with typesSatisfyConstraint #82147

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 5 commits into from
Jun 13, 2025

Conversation

hamishknight
Copy link
Contributor

Escaping solver-allocated types into a nested allocation arena is problematic since we can e.g lazily compute the ContextSubMap for a NominalOrBoundGenericNominalType, which is then destroyed when we exit the nested arena. Ensure we don't pass any types with type variables or placeholders to typesSatisfyConstraint.

rdar://152763265

@slavapestov
Copy link
Contributor

Nice catch!

We should never end up here, we should have placeholder bindings
instead for holes.
I don't believe we ever form these types, and if we did we aren't
correctly handling them in `Solution::simplifyType`. Let's just
enforce we don't get them.
Escaping solver-allocated types into a nested allocation arena is
problematic since we can e.g lazily compute the `ContextSubMap` for a
`NominalOrBoundGenericNominalType`, which is then destroyed when we
exit the nested arena. Ensure we don't pass any types with type
variables or placeholders to `typesSatisfyConstraint`.

rdar://152763265
…entMemberType`

`substBase` here can contain type variables or placeholders, avoid
using them as the original ErrorTypes since ErrorTypes cannot be
solver-allocated currently. This only affects type printing so
shouldn't matter much.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight
Copy link
Contributor Author

@swift-ci please SourceKit stress test

@hamishknight hamishknight merged commit 9a0a831 into swiftlang:main Jun 13, 2025
6 checks passed
@hamishknight hamishknight deleted the fix-nested-arenas branch June 13, 2025 15:53
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.

3 participants