Skip to content

[5.4][SourceKit] Verify the stdlib is loaded before creating an AST #37483

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
May 19, 2021

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 18, 2021

Cherry-picks #36797 to release/5.4.

  • Explanation: When sourcekitd is unable to load the stdlib, report an error and fail early instead of trying to compile and crashing somewhere in the type checker because required types from the standard library cannot be found.
  • Scope: sourcektid requests that are unable to load the standard library
  • Risk: Very low
  • Testing: None, the fix was synthesized from a set of crash reports
  • Issue: rdar://78035923
  • Reviewer: Argyrios Kyrtzidis (@akyrtzi)

We have seen a couple of crashes that look like they are being caused by `sourcekitd` being unable to load the Swift stdlib. Emit a proper error message explaining the issue instead of crashing.

This change assumes that all sourcekitd requests that create an AST require the stdlib. IMHO this is a reasonable assumption.

Fixes rdar://75740572 by catching the crash in the new check.
@ahoppen ahoppen added the r5.4 label May 18, 2021
@ahoppen
Copy link
Member Author

ahoppen commented May 18, 2021

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented May 18, 2021

@swift-ci Please nominate

@ahoppen ahoppen requested a review from akyrtzi May 18, 2021 16:59
@najacque
Copy link
Contributor

@swift-ci Please nominate

@ahoppen ahoppen merged commit 7213dab into swiftlang:release/5.4 May 19, 2021
@ahoppen ahoppen deleted the pr-5.4/rdar-78035923 branch May 19, 2021 19:39
@AnthonyLatsis AnthonyLatsis added swift 5.4 🍒 release cherry pick Flag: Release branch cherry picks labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants