Skip to content

[Diagnostics] Tailored diagnostic for "condition" expression #27107

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 20, 2019

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Sep 10, 2019

Since all condition expressions supposed to be convertible
to Bool, let's use that type as contextual and produce a
tailored diagnostic.

@xedin xedin requested a review from hborla September 10, 2019 20:59
@xedin
Copy link
Contributor Author

xedin commented Sep 10, 2019

Unfortunately this has to wait until #27063 lands.

Since all condition expressions supposed to be convertible
to `Bool`, let's use that type as contextual and produce a
tailored diagnostic.
Type-check of implicit `~=` has to be handled specially because
constraint system doesn't yet have a full access to pattern-matching
context where `~=` is used which would produce incorrect diagnostics.
@xedin xedin force-pushed the if-conditional-diag branch from f6819b8 to 232185e Compare September 20, 2019 20:32
@xedin xedin marked this pull request as ready for review September 20, 2019 20:32
@xedin
Copy link
Contributor Author

xedin commented Sep 20, 2019

@swift-ci please smoke test

@xedin
Copy link
Contributor Author

xedin commented Sep 20, 2019

@swift-ci please smoke test macOS platform

@xedin
Copy link
Contributor Author

xedin commented Sep 20, 2019

Looks like the Python lint failure should be fixed by #27278

@xedin
Copy link
Contributor Author

xedin commented Sep 20, 2019

@swift-ci please smoke test

@xedin xedin merged commit 81c7be8 into swiftlang:master Sep 20, 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