Skip to content

[CSGen] Avoid failing on invalid declarations #34036

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 3 commits into from
Sep 23, 2020

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Sep 22, 2020

Solver needs to handle invalid declarations but only in
"code completion" mode since declaration in question might
not be associated with code completion, otherwise (if constraint
generation fails) there is going to be no completion results.

In order to make this work we need to:

  • Extend HoleType to allow it to be originated from VarDecl;
  • Add a special flag to constraint system which specifies that solving is for "code completion";
  • Use special access for VarDecl types which respects constraint system flags
    and can convert any ErrorTypes into HoleTypess.

Associating holes directly with declarations is useful in
cases when declarations are invalid e.g. directly `ErrorType`
or have error types inside.
Solver needs to handle invalid declarations but only in
"code completion" mode since declaration in question might
not be associated with code completion, otherwise (if constraint
generation fails) there is going to be no completion results.
@xedin xedin requested review from hborla and nathawes September 22, 2020 23:31
@xedin
Copy link
Contributor Author

xedin commented Sep 23, 2020

@swift-ci please smoke test

@xedin
Copy link
Contributor Author

xedin commented Sep 23, 2020

@swift-ci please smoke test Windows platform

@xedin xedin changed the base branch from master to main September 23, 2020 18:26
Copy link
Member

@hborla hborla left a comment

Choose a reason for hiding this comment

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

One small comment/question about the property wrapper case, but otherwise LGTM!

@xedin xedin merged commit c946c80 into swiftlang:main Sep 23, 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.

3 participants