Skip to content

[CodeCompletion] Fix a crash in collectPossibleReturnTypesFromContext #34486

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
Oct 29, 2020

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Oct 28, 2020

Avoid re-typechecking for nested closures. For example:

  Something {
    Other {
      #^COMPLETE^#
    }
  }

If Something is successfully type checked but Other is failed, the outer closure has type, but the inner closure doesn't. In such state, when the type of Other is requested, the outer closure used to be re-typechecked. That may cause a crash because it may contain expressions CSGen doesn't expect.

rdar://problem/69246891

Avoid re-typechecking for nested closures. For example:

  Something {
    Other {
      #^COMPLETE^#
    }
  }

If 'Something' is successfully type checked but 'Other' is failed, the
outer closure has type, but the inner closure doesn't. In such state,
when the type of 'Other' is requested, the outer closure used to be
re-typechecked. That may cause crash because it may contain expressions
CSGen doesn't expect.

rdar://problem/69246891
@rintaro
Copy link
Member Author

rintaro commented Oct 28, 2020

@swift-ci Please smoke test

@rintaro rintaro requested a review from nathawes October 28, 2020 22:26
Copy link
Contributor

@nathawes nathawes left a comment

Choose a reason for hiding this comment

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

LGTM!

@rintaro rintaro merged commit a69502e into swiftlang:main Oct 29, 2020
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