Skip to content

[5.1 06/12][CSApply] Don't try to transform editor placeholder if it's type is invalid #25463

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

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jun 14, 2019

  • Explanation: CSDiag could re-typecheck closure or other expression which has
    editor placeholder inside allowing type variables be bound to unresolved
    type, which doesn't really form a valid solution to be applied to AST.
    So we need to guard against trying to transform placeholder into a call
    to _undefined in such case, otherwise in asserts build it's going to crash
    with an assert but in release build it would crash in some other place e.g.
    SILGen or trying to type-check captures.

  • Issue: rdar://problem/48937223, rdar://problem/51599529

  • Scope: Diagnostics, in subset of cases when failure detector tries to re-typecheck closures with editor placeholders in them.

  • Risk: Low.

  • Testing: Added compiler regression tests.

  • Reviewed by: @DougGregor

Resolves: rdar://problem/48937223
Resolves: rdar://problem/51599529

xedin added 2 commits June 14, 2019 00:13
If solution application is attempted for one of the sub-expressions,
while diagnostics are trying to narrow down where the failure is
located, don't record that captures need to be computed for closures,
because that could fail later on as in such conditions expressions
are not guaranteed to have correct types (e.g. some types could be
set to "unresolved").

(cherry picked from commit 59bc60e)
…nvalid

CSDiag could re-typecheck closure or other expression which has editor
placeholder inside allowing type variables be bound to unresolved
type, which doesn't really form a valid solution to be applied to AST.
So we need to guard against trying to transform placeholder into a call
to `_undefined` in such case, otherwise in asserts build it's going to
crash with an assert but in release build it would crash in some other
place e.g. xSILGen or trying to type-check captures.

Resolves: rdar://problem/48937223
Resolves: rdar://problem/51599529
(cherry picked from commit 26d0324)
@xedin
Copy link
Contributor Author

xedin commented Jun 14, 2019

@swift-ci please test

@xedin xedin merged commit 3c025ff into swiftlang:swift-5.1-branch-06-12-2019 Jun 14, 2019
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