Skip to content

AST: Fix crash when type parameter is substituted with an existential [6.2] #81918

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

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jun 2, 2025

6.2 cherry-pick of #81913

  • Description: getContextSubstitutionMap() would crash on an invalid input instead of returning a substitution map with an invalid conformance. This manifested as a crash-on-invalid where the user wrote "T.Value: Collection" rather than "T.Value == Collection".
  • Origination: This is a regression from Simplify and optimize SubstitutionMap #75068.
  • Risk: Low. This just skips a "fast path" that was incorrect for the given inputs.
  • Radar: Fixes rdar://151479861.
  • Reviewed by: @DougGregor

getContextSubstitutionMap() didn't handle the case where getAnyNominal()
returns a ProtocolDecl. This should not take the "fast path", which is
only suitable for concrete nominals.

This manifested as a crash-on-invalid -- the user probably meant to write
"T.Value: Collection" rather than "T.Value == Collection".

Fixes rdar://151479861.
@slavapestov slavapestov requested a review from a team as a code owner June 2, 2025 23:37
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

LGTM

@slavapestov slavapestov merged commit 42c0e71 into swiftlang:release/6.2 Jun 3, 2025
5 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.

2 participants