Skip to content

[Sema] Fix two assertion failures/crashes in solver-based key-path completion #38299

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 2 commits into from
Jul 8, 2021

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jul 7, 2021

This fixes two assertion failures/crashes in the solver-based key path completion I introduced in #38049, which were found by the stress tester.

Record type of identity key paths in the constraint system

If we are completing e.g. \.self.#^COMPLETE^# we use the type of self as the base type for the completion. In order to retrieve that, we need to record the type.

Fixes rdar://80271346 [SR-14887]

Check completion key path component to determine if completion node was type checked in multi expression closure

To check whether the code completion node was type checked in a multi statement closure, we were assuming that we had a code completion expression and not considering that we could also complete in a key path component. When applicable, check if the completion key path component has a type to determine if the completion node was type checked as part of a multi-statement closure.

Resolves rdar://80271598 [SR-14891]

If we are completing e.g. `\.self.#^COMPLETE^#` we use the type of `self` as the base type for the completion. In order to retrieve that, we need to record the type.

Fixes rdar://80271346 [SR-14887]
@ahoppen ahoppen requested a review from xedin July 7, 2021 22:09
… node was type checked in multi expression closure

To check whether the code completion node was type checked in a multi statement closure, we were assuming that we had a code completion *expression* and not considering that we could also complete in a key path component. When applicable, check if the completion key path component has a type to determine if the completion node was type checked as part of a multi-statement closure.

Resolves rdar://80271598 [SR-14891]
@ahoppen ahoppen force-pushed the pr/key-path-completion-fixes branch from 4a72350 to 917fdc9 Compare July 7, 2021 22:24
@ahoppen
Copy link
Member Author

ahoppen commented Jul 7, 2021

@swift-ci Please smoke test

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