{"action":"created","issue":{"url":"https://api.github.com/repos/norio-nomura/Nimble/issues/5","repository_url":"https://api.github.com/repos/norio-nomura/Nimble","labels_url":"https://api.github.com/repos/norio-nomura/Nimble/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/norio-nomura/Nimble/issues/5/comments","events_url":"https://api.github.com/repos/norio-nomura/Nimble/issues/5/events","html_url":"https://github.com/norio-nomura/Nimble/pull/5","id":169036037,"number":5,"title":"[WIP] Xcode 8 beta 4 and 5 + Swift 3 compatibility","user":{"login":"mokagio","id":1218433,"avatar_url":"https://avatars.githubusercontent.com/u/1218433?v=3","gravatar_id":"","url":"https://api.github.com/users/mokagio","html_url":"https://github.com/mokagio","followers_url":"https://api.github.com/users/mokagio/followers","following_url":"https://api.github.com/users/mokagio/following{/other_user}","gists_url":"https://api.github.com/users/mokagio/gists{/gist_id}","starred_url":"https://api.github.com/users/mokagio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mokagio/subscriptions","organizations_url":"https://api.github.com/users/mokagio/orgs","repos_url":"https://api.github.com/users/mokagio/repos","events_url":"https://api.github.com/users/mokagio/events{/privacy}","received_events_url":"https://api.github.com/users/mokagio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-08-03T02:54:04Z","updated_at":"2016-08-11T19:27:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/norio-nomura/Nimble/pulls/5","html_url":"https://github.com/norio-nomura/Nimble/pull/5","diff_url":"https://github.com/norio-nomura/Nimble/pull/5.diff","patch_url":"https://github.com/norio-nomura/Nimble/pull/5.patch"},"body":"Hi 👋. I had a go at adding Xcode 8 beta 4 support and this is as far as I've\r\ngot.\r\n\r\nThere are still two issues:\r\n\r\n- `Boolean` has been removed in a breaking way, [SE-109](https://github.com/apple/swift-evolution/blob/a76560fbd834c3a4b0e801f010f06e26e8387073/proposals/0109-remove-boolean.md), which might require us to change the behaviour of `beTruthy` and `beFalsy`.\r\n- The test `testNegativeMatchesWithClosure` is failing <del>due to `if errorType != nil || closure != nil` inside `setFailureMessageForError` resulting false despite `closure` being not `nil` 😳</del>\r\n\r\n**It is definitely possible that I'm missing something here, if so feel free to cherry pick only the useful changes.**\r\n\r\n### More on the `Boolean` issue\r\n\r\nAs said `Boolean` has been removed, making this code fail to build.\r\n\r\n```swift\r\npublic func beTruthy<T>() -> MatcherFunc<T> {\r\n    return MatcherFunc { actualExpression, failureMessage in\r\n        failureMessage.postfixMessage = \"be truthy\"\r\n        let actualValue = try actualExpression.evaluate()\r\n        if let actualValue = actualValue {\r\n            if let actualValue = actualValue as? Boolean {\r\n                return actualValue.boolValue == true\r\n            }\r\n        }\r\n        return actualValue != nil\r\n    }\r\n}\r\n```\r\n\r\nI was able to work around it by simply using `Bool`:\r\n\r\n```diff\r\n- if let actualValue = actualValue as? Boolean {\r\n-     return actualValue.boolValue == true\r\n+ if let actualValue = actualValue as? Bool {\r\n+     return actualValue == true\r\n}\r\n```\r\n\r\nThis change though makes the test using `ConvertsToBool`, which I tried to tweak to make it conform to `ExpressibleByBooleanLiteral` in 72785699c3050c5c8cf3967b52de89fbcc021edc, fail.\r\n\r\nThat is due to the fact that `ExpressibleByBooleanLiteral`, as far as I've seen, only defines a way to init a value using a `BooleanLiteral`, which is a `Bool` typealias, not how to convert it.\r\n\r\n`ExpressibleByBooleanLiteral` has been introduced by [SE-115](https://github.com/apple/swift-evolution/blob/57b4754fadad9dcea55a4a4f003691a224048090/proposals/0115-literal-syntax-protocols.md).\r\n\r\nAnd even if it did have the `boolValue` method, since the protocol is generic, we wouldn't be able to use it in an `as` clause.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/norio-nomura/Nimble/issues/comments/239265421","html_url":"https://github.com/norio-nomura/Nimble/pull/5#issuecomment-239265421","issue_url":"https://api.github.com/repos/norio-nomura/Nimble/issues/5","id":239265421,"user":{"login":"mokagio","id":1218433,"avatar_url":"https://avatars.githubusercontent.com/u/1218433?v=3","gravatar_id":"","url":"https://api.github.com/users/mokagio","html_url":"https://github.com/mokagio","followers_url":"https://api.github.com/users/mokagio/followers","following_url":"https://api.github.com/users/mokagio/following{/other_user}","gists_url":"https://api.github.com/users/mokagio/gists{/gist_id}","starred_url":"https://api.github.com/users/mokagio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mokagio/subscriptions","organizations_url":"https://api.github.com/users/mokagio/orgs","repos_url":"https://api.github.com/users/mokagio/repos","events_url":"https://api.github.com/users/mokagio/events{/privacy}","received_events_url":"https://api.github.com/users/mokagio/received_events","type":"User","site_admin":false},"created_at":"2016-08-11T19:27:45Z","updated_at":"2016-08-11T19:27:45Z","body":"I implemented and pushed my idea from [the previous comment](https://github.com/norio-nomura/Nimble/pull/5#issuecomment-239262794), to better show how it looks like, and see if the tests pass: f22ff06.\r\n\r\nI'm happy to remove that commit if a better solution is proposed."}}
{"actor":{"display_login":"mokagio"}}