Skip to content

[Constraint solver] Fix an issue with rewriting OpenExistentialExpr. #10058

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
Jun 2, 2017
Merged

[Constraint solver] Fix an issue with rewriting OpenExistentialExpr. #10058

merged 1 commit into from
Jun 2, 2017

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented Jun 2, 2017

If we fail when doing a coercion while generating an OpenExistentialExpr
when applying a solution during type checking, make sure that the opaque
value on that OpenExistentialExpr is cleared.

We do not visit these during normal AST walks because they normally
appear in the subexpression held by the OpenExistentialExpr. In this
case, however, we replace that subexpression with an ErrorExpr which
means we will not visit the opaque value at all, so certain operations,
like setting the type on the opaque value, will never happen, and we can
run into problems later by code that assumes the type is set.

It seems reasonable to just clear these out in cases like this since
they are not reachable by any normal means.

If we fail when doing a coercion while generating an OpenExistentialExpr
when applying a solution during type checking, make sure that the opaque
value on that OpenExistentialExpr is cleared.

We do not visit these during normal AST walks because they normally
appear in the subexpression held by the OpenExistentialExpr. In this
case, however, we replace that subexpression with an ErrorExpr which
means we will not visit the opaque value at all, so certain operations,
like setting the type on the opaque value, will never happen, and we can
run into problems later by code that assumes the type is set.

It seems reasonable to just clear these out in cases like this since
they are not reachable by any normal means.
@rudkx
Copy link
Contributor Author

rudkx commented Jun 2, 2017

@swift-ci Please smoke test

@rudkx rudkx merged commit 5bcf8a9 into swiftlang:master Jun 2, 2017
@rudkx rudkx deleted the clear-opaque-expr-on-open-existential branch June 2, 2017 03:54
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.

1 participant