Skip to content

Conversation

nkcsgexi
Copy link
Contributor

Due to migration reasons, types used to conform to BooleanType, which
must contain a member var 'boolValue', now does not convert to Bool. This patch
adds a specific diagnosis/fixit to explicitly invoke 'boolValue' to please the
context types.

Resolved bug number: (SR-)


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

A smoke test on macOS does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library only for macOS. Simulator standard libraries and
    device standard libraries are not built.
  3. lldb is not built.
  4. The test and validation-test targets are run only for macOS. The optimized
    version of these tests are not run.

A smoke test on Linux does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library incrementally.
  3. lldb is built incrementally.
  4. The swift test and validation-test targets are run. The optimized version of these
    tests are not run.
  5. lldb is tested.

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

…emoval.

Due to migration reasons, types used to conform to BooleanType, which
must contain a member var 'boolValue', now does not convert to Bool. This patch
adds a specific diagnosis/fixit to explicitly invoke 'boolValue' to please the
context types.
@nkcsgexi
Copy link
Contributor Author

@swift-ci test macOS

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 6b51283
Test requested by - @nkcsgexi

@akyrtzi
Copy link
Contributor

akyrtzi commented Aug 19, 2016

LGTM.

@akyrtzi
Copy link
Contributor

akyrtzi commented Aug 19, 2016

Do you think we can also handle this case as well:

_ = true && a

This gives
error: cannot convert value of type 'BoolFoo' to expected argument type 'Bool'

@nkcsgexi
Copy link
Contributor Author

@swift-ci Please smoke test

@nkcsgexi
Copy link
Contributor Author

@akyrtzi Did we see this case in actual codebase?

// tries to add a specific diagnosis/fixit to explicitly invoke 'boolValue'.
if (toType->isBool()) {
auto LookupResult = CS->TC.lookupMember(CS->DC, fromType,
DeclName(CS->DC->getASTContext().getIdentifier("boolValue")));
Copy link
Contributor

Choose a reason for hiding this comment

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

CS->TC.Context gets there a little faster.

@jrose-apple
Copy link
Contributor

This is rdar://problem/27894712, BTW, if not other Radars as well.

@nkcsgexi
Copy link
Contributor Author

@swift-ci Please smoke test

@nkcsgexi
Copy link
Contributor Author

@jrose-apple Comments addressed!

@nkcsgexi
Copy link
Contributor Author

@swift-ci Please smoke test

@nkcsgexi
Copy link
Contributor Author

@swift-ci Please test OS X platform

@nkcsgexi
Copy link
Contributor Author

@swift-ci test macOS

@nkcsgexi nkcsgexi merged commit 5227355 into swiftlang:master Aug 19, 2016
@nkcsgexi nkcsgexi deleted the bool-fixit branch August 19, 2016 15:29
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.

4 participants