Skip to content

Conversation

@hamishknight
Copy link
Contributor

Skipping type-checking the body when the preamble fails to type-check seems to be more of a historical artifact than intentional behavior. Certain elements of the body may still get type-checked through request evaluation, and as such may introduce autoclosures that won't be properly contextualized.

Make sure we continue type-checking the body even if the preamble fails. We already invalidate any variables bound in the element pattern, so downstream type-checking should be able to handle it just fine. This ensures autoclosures get contextualized, and that we're still able to provide semantic diagnostics for other issues in the body.

rdar://136500008

Skipping type-checking the body when the preamble fails to type-check
seems to be more of a historical artifact than intentional behavior.
Certain elements of the body may still get type-checked through
request evaluation, and as such may introduce autoclosures that won't
be properly contextualized. 

Make sure we continue type-checking the body even if the preamble
fails. We already invalidate any variables bound in the element
pattern, so downstream type-checking should be able to handle it
just fine. This ensures autoclosures get contextualized, and that
we're still able to provide semantic diagnostics for other issues in
the body.

rdar://136500008
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight merged commit 48f6f24 into swiftlang:main May 16, 2025
5 checks passed
@hamishknight hamishknight deleted the last-straw branch May 16, 2025 22:57
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