{"action":"closed","issue":{"url":"https://api.github.com/repos/Quick/Nimble/issues/495","repository_url":"https://api.github.com/repos/Quick/Nimble","labels_url":"https://api.github.com/repos/Quick/Nimble/issues/495/labels{/name}","comments_url":"https://api.github.com/repos/Quick/Nimble/issues/495/comments","events_url":"https://api.github.com/repos/Quick/Nimble/issues/495/events","html_url":"https://github.com/Quick/Nimble/issues/495","id":294779676,"number":495,"title":"Crash when using `contains` matcher with `Dictionary.Values`","user":{"login":"jberkel","id":18891,"avatar_url":"https://avatars3.githubusercontent.com/u/18891?v=4","gravatar_id":"","url":"https://api.github.com/users/jberkel","html_url":"https://github.com/jberkel","followers_url":"https://api.github.com/users/jberkel/followers","following_url":"https://api.github.com/users/jberkel/following{/other_user}","gists_url":"https://api.github.com/users/jberkel/gists{/gist_id}","starred_url":"https://api.github.com/users/jberkel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jberkel/subscriptions","organizations_url":"https://api.github.com/users/jberkel/orgs","repos_url":"https://api.github.com/users/jberkel/repos","events_url":"https://api.github.com/users/jberkel/events{/privacy}","received_events_url":"https://api.github.com/users/jberkel/received_events","type":"User","site_admin":false},"labels":[{"id":110212983,"url":"https://api.github.com/repos/Quick/Nimble/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-02-06T14:30:48Z","updated_at":"2018-03-23T01:06:22Z","closed_at":"2018-03-23T01:06:22Z","author_association":"NONE","body":"- [x] I have read [CONTRIBUTING](https://github.com/Quick/Nimble/blob/master/CONTRIBUTING.md) and have done my best to follow them.\r\n\r\n### What did you do?\r\n\r\nTried to test for membership in [Dictionary.Values](https://developer.apple.com/documentation/swift/dictionary.values) (Swift 4)\r\n\r\n```swift\r\nit(\"contains a value\") {\r\n    let foo = [\"a\": 1, \"b\": 2]\r\n    expect(foo.values).to(contain(1, 2))\r\n}\r\n```\r\n\r\n### What did you expect to happen?\r\n\r\nTest passes\r\n\r\n### What actually happened instead?\r\n\r\nTest crashes\r\n\r\n```\r\n thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)\r\n  * frame #0: 0x000000010611794b libobjc.A.dylib`objc_msgSend + 11\r\n    frame #1: 0x0000000106a346ce CoreFoundation`-[NSDictionary descriptionWithLocale:indent:] + 382\r\n    frame #2: 0x000000010a5955a5 libswiftFoundation.dylib`merged protocol witness for Swift.CustomStringConvertible.description.getter : Swift.String in conformance __ObjC.NSObject : Swift.CustomStringConvertible in Foundation + 37\r\n    frame #3: 0x000000010a595570 libswiftFoundation.dylib`protocol witness for Swift.CustomDebugStringConvertible.debugDescription.getter : Swift.String in conformance __ObjC.NSObject : Swift.CustomDebugStringConvertible in Foundation + 16\r\n    frame #4: 0x0000000109e2c366 libswiftCore.dylib`Swift._debugPrint_unlocked<A, B where B: Swift.TextOutputStream>(A, inout B) -> () + 438\r\n    frame #5: 0x0000000109ff5ec9 libswiftCore.dylib`function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed and Exploded> of Swift._adHocPrint_unlocked<A, B where B: Swift.TextOutputStream>(A, Swift.Mirror, inout B, isDebugPrint: Swift.Bool) -> () + 825\r\n    frame #6: 0x0000000109e2c6e0 libswiftCore.dylib`Swift._debugPrint_unlocked<A, B where B: Swift.TextOutputStream>(A, inout B) -> () + 1328\r\n    frame #7: 0x0000000109ff6cd0 libswiftCore.dylib`function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed and Exploded> of Swift._adHocPrint_unlocked<A, B where B: Swift.TextOutputStream>(A, Swift.Mirror, inout B, isDebugPrint: Swift.Bool) -> () + 4416\r\n    frame #8: 0x0000000109e2c6e0 libswiftCore.dylib`Swift._debugPrint_unlocked<A, B where B: Swift.TextOutputStream>(A, inout B) -> () + 1328\r\n    frame #9: 0x0000000109ff5ec9 libswiftCore.dylib`function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed and Exploded> of Swift._adHocPrint_unlocked<A, B where B: Swift.TextOutputStream>(A, Swift.Mirror, inout B, isDebugPrint: Swift.Bool) -> () + 825\r\n    frame #10: 0x0000000109ff7f46 libswiftCore.dylib`function signature specialization <preserving fragile attribute, Arg[0] = Owned To Guaranteed> of Swift._print_unlocked<A, B where B: Swift.TextOutputStream>(A, inout B) -> () + 1686\r\n    frame #11: 0x0000000109decba6 libswiftCore.dylib`Swift.String.init<A>(describing: A) -> Swift.String + 70\r\n    frame #12: 0x0000000120cb9346 Nimble`stringify<A>(value=<unavailable>) at Stringers.swift:156\r\n    frame #13: 0x0000000120cbc24e Nimble`stringify<A>(value=<unavailable>) at Stringers.swift:162\r\n    frame #14: 0x0000000120c80ada Nimble`run #1 <A>(description=nil, to=\"to\", predicate=(matcher = 0x0000000120caa6d0 Nimble`partial apply forwarder for closure #1 (Nimble.Expression<A>) throws -> Nimble.PredicateResult in Nimble.Predicate.after(f: (Nimble.Expression<A>, Nimble.PredicateResult) throws -> Nimble.PredicateResult) -> Nimble.Predicate<A> at Predicate.swift), expression=Nimble.Expression<Swift.Dictionary<Swift.String, Swift.Int>.Values> @ 0x00007fff5d0861c0, style=toMatch) in execute<A>(_:_:_:to:description:captureExceptions:) at Expectation.swift:48\r\n    frame #15: 0x0000000120c81462 Nimble`closure #2 in execute<A>(result=0x000060000022bd70, description=nil, to=\"to\", predicate=(matcher = 0x0000000120caa6d0 Nimble`partial apply forwarder for closure #1 (Nimble.Expression<A>) throws -> Nimble.PredicateResult in Nimble.Predicate.after(f: (Nimble.Expression<A>, Nimble.PredicateResult) throws -> Nimble.PredicateResult) -> Nimble.Predicate<A> at Predicate.swift), expression=Nimble.Expression<Swift.Dictionary<Swift.String, Swift.Int>.Values> @ 0x00007fff5d086388, style=toMatch) at Expectation.swift:65\r\n    frame #16: 0x0000000120c8174b Nimble`partial apply for closure #2 in execute<A>(_:_:_:to:description:captureExceptions:) at Expectation.swift:0\r\n    frame #17: 0x0000000120c14559 Nimble`thunk for @callee_owned () -> () at AssertionRecorder.swift:0\r\n    frame #18: 0x0000000120c0e1f8 Nimble`-[NMBExceptionCapture tryBlock:](self=0x0000600000226e20, _cmd=\"tryBlock:\", unsafeBlock=0x0000000120c14530) at NMBExceptionCapture.m:21\r\n    frame #19: 0x0000000120c801a5 Nimble`execute<A>(expression=Nimble.Expression<Swift.Dictionary<Swift.String, Swift.Int>.Values> @ 0x00007fff5d0868b8, style=toMatch, predicate=(matcher = 0x0000000120caa6d0 Nimble`partial apply forwarder for closure #1 (Nimble.Expression<A>) throws -> Nimble.PredicateResult in Nimble.Predicate.after(f: (Nimble.Expression<A>, Nimble.PredicateResult) throws -> Nimble.PredicateResult) -> Nimble.Predicate<A> at Predicate.swift), to=\"to\", description=nil, captureExceptions=true) at Expectation.swift:66\r\n    frame #20: 0x0000000120c826fc Nimble`Expectation.to(predicate=(matcher = 0x0000000120caa6d0 Nimble`partial apply forwarder for closure #1 (Nimble.Expression<A>) throws -> Nimble.PredicateResult in Nimble.Predicate.after(f: (Nimble.Expression<A>, Nimble.PredicateResult) throws -> Nimble.PredicateResult) -> Nimble.Predicate<A> at Predicate.swift), description=nil, self=Nimble.Expectation<Swift.Dictionary<Swift.String, Swift.Int>.Values> @ 0x00007fff5d086a58) at Expectation.swift:112\r\n    frame #21: 0x00000001206d7928 tests`closure #2 in closure #2 in closure #6 in closure #3 in XXX.spec() at XXXSpec.swift:163\r\n    frame #22: 0x0000000120da1d79 Quick`Example.run(self=0x0000600000482f80) at Example.swift:92\r\n    frame #23: 0x0000000120da2994 Quick`@objc Example.run() at Example.swift:0\r\n```\r\n\r\nWorkaround:\r\n\r\n```swift\r\nit(\"contains a value\") {\r\n    let foo = [\"a\": 1, \"b\": 2]\r\n    let values = Array(foo.values)\r\n    expect(values).to(contain(1, 2))\r\n}\r\n```\r\n\r\n### Environment\r\n\r\nList the software versions you're using:\r\n\r\n - Quick: 1.2.0\r\n - Nimble: 7.0.3\r\n - Xcode Version: 9.2 (9C40b)\r\n - Swift Version: 4.0\r\n\r\nPlease also mention which package manager you used and its version. Delete the\r\nother package managers in this list:\r\n\r\n - Cocoapods: 1.4.0\r\n"}}
{"actor":{"display_login":"jberkel"}}