Skip to content

[Constraint system] Set the contextual type for condition expressions. #29432

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

Conversation

DougGregor
Copy link
Member

Set the contextual type of conditional expressions (to Bool) with the
"condition" purpose so we get customized diagnostics for mistakes such
as

if x.property = y { }

Prior to this, we'd get generic "() isn't convertible to Bool"
diagnostic. Now we get

use of '=' in a boolean context, did you mean '=='?

We’ll want to pull these back out for diagnostic purposes.
Set the contextual type of conditional expressions (to Bool) with the
"condition" purpose so we get customized diagnostics for mistakes such
as

    if x.property = y { }

Prior to this, we'd get generic "() isn't convertible to Bool"
diagnostic. Now we get

    use of '=' in a boolean context, did you mean '=='?
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor requested a review from xedin January 24, 2020 18:19
@DougGregor DougGregor merged commit 8e5ae4c into swiftlang:master Jan 24, 2020
@DougGregor DougGregor deleted the contextual-conditions-for-function-builders branch January 24, 2020 20:41
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