Skip to content
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

[CodeComplete] Don't crash if solution doesn't contain a type for the parsed expression #39410

Merged
merged 1 commit into from
Sep 24, 2021

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Sep 23, 2021

In rdar://82027315 we are trying to retrieve the type of an ASTNode that doesn’t have a type associated with it in the solution from getTypeForCompletion.

This shouldn’t happen but we shouldn’t crash because of it, either. Since we already have handling logic for null types returned by getTypeForCompletion in place, I’m adding a check if the solution contains a type for the given node. If not, we’re causing an assertion failure and are returning a null type in non-assert builds.

rdar://82027315

… parsed expression

In rdar://82027315 we are trying to retrieve the type of an `ASTNode` that doesn’t have a type associated with it in the solution from `getTypeForCompletion`.

This shouldn’t happen but we shouldn’t crash because of it, either. Since we already have handling logic for null types returned by `getTypeForCompletion` in place, I’m adding a check if the solution contains a type for the given node. If not, we’re causing an assertion failure and are returning a null type in non-assert builds.
@ahoppen ahoppen requested review from xedin and rintaro September 23, 2021 10:49
@ahoppen
Copy link
Member Author

ahoppen commented Sep 23, 2021

@swift-ci Please smoke test

@ahoppen ahoppen merged commit e1a9be5 into swiftlang:main Sep 24, 2021
@ahoppen ahoppen deleted the pr/node-has-no-type-in-solution branch October 5, 2021 16:01
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