{"action":"opened","issue":{"url":"https://api.github.com/repos/kylef/Spectre/issues/14","labels_url":"https://api.github.com/repos/kylef/Spectre/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/kylef/Spectre/issues/14/comments","events_url":"https://api.github.com/repos/kylef/Spectre/issues/14/events","html_url":"https://github.com/kylef/Spectre/issues/14","id":127065364,"number":14,"title":"Support type comparison","user":{"login":"ryuichis","id":4386920,"avatar_url":"https://avatars.githubusercontent.com/u/4386920?v=3","gravatar_id":"","url":"https://api.github.com/users/ryuichis","html_url":"https://github.com/ryuichis","followers_url":"https://api.github.com/users/ryuichis/followers","following_url":"https://api.github.com/users/ryuichis/following{/other_user}","gists_url":"https://api.github.com/users/ryuichis/gists{/gist_id}","starred_url":"https://api.github.com/users/ryuichis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryuichis/subscriptions","organizations_url":"https://api.github.com/users/ryuichis/orgs","repos_url":"https://api.github.com/users/ryuichis/repos","events_url":"https://api.github.com/users/ryuichis/events{/privacy}","received_events_url":"https://api.github.com/users/ryuichis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-17T00:21:27Z","updated_at":"2016-01-17T00:21:27Z","closed_at":null,"body":"First of all, thank you for working on this, very neat tool. \r\n\r\nI just tried to compare the object type with my expectation. I got it to work with \r\n\r\nhttps://github.com/ryuichis/swift-ast/blob/66bb167818d4ecc5b009f4f19085826e861d37f5/Tests/declaration/ParsingTypeAliasDeclarationSpec.swift#L119\r\n\r\nHowever, if I change the line to\r\n\r\n`try expect(Mirror(reflecting: node.type).subjectType) == testType`\r\n\r\nthen I got the following error:\r\n\r\n```\r\nTests/declaration/ParsingTypeAliasDeclarationSpec.swift:119:71: error: binary operator '==' cannot be applied to operands of type 'Expectation<Any.Type>' (aka 'Expectation<protocol<>.Type>') and 'Type.Type'\r\n                try expect(Mirror(reflecting: node.type).subjectType) == testType\r\n                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~\r\nTests/declaration/ParsingTypeAliasDeclarationSpec.swift:119:71: note: overloads for '==' exist with these partially matching parameter lists: (FloatingPointClassification, FloatingPointClassification), (_MirrorDisposition, _MirrorDisposition), (Mirror.DisplayStyle, Mirror.DisplayStyle), (Bool, Bool), (Any.Type?, Any.Type?), (COpaquePointer, COpaquePointer), (Character, Character), (UInt8, UInt8), (Int8, Int8), (UInt16, UInt16), (Int16, Int16), (UInt32, UInt32), (Int32, Int32), (UInt64, UInt64), (Int64, Int64), (UInt, UInt), (Int, Int), (Float, Float), (Double, Double), (Float80, Float80), (ObjectIdentifier, ObjectIdentifier), (String, String), (Index, Index), (String.UnicodeScalarView.Index, String.UnicodeScalarView.Index), (String.UTF16View.Index, String.UTF16View.Index), (String.UTF8View.Index, String.UTF8View.Index), (UnicodeScalar, UnicodeScalar), (_SwiftNSOperatingSystemVersion, _SwiftNSOperatingSystemVersion), (Bit, Bit), (AnyForwardIndex, AnyForwardIndex), (AnyBidirectionalIndex, AnyBidirectionalIndex), (AnyRandomAccessIndex, AnyRandomAccessIndex), (AccessLevel, AccessLevel), (ContextualKeywordType, ContextualKeywordType), (KeywordType, KeywordType), (PunctuatorType, PunctuatorType), (Token, Token), (ContiguousArray<Element>, ContiguousArray<Element>), (ArraySlice<Element>, ArraySlice<Element>), (Array<Element>, Array<Element>), (AutoreleasingUnsafeMutablePointer<Memory>, AutoreleasingUnsafeMutablePointer<Memory>), (T, T), (LazyFilterIndex<Base>, LazyFilterIndex<Base>), (FlattenCollectionIndex<BaseElements>, FlattenCollectionIndex<BaseElements>), (FlattenBidirectionalCollectionIndex<BaseElements>, FlattenBidirectionalCollectionIndex<BaseElements>), (Set<Element>, Set<Element>), ([Key : Value], [Key : Value]), (SetIndex<Element>, SetIndex<Element>), (DictionaryIndex<Key, Value>, DictionaryIndex<Key, Value>), (_HeapBuffer<Value, Element>, _HeapBuffer<Value, Element>), (HalfOpenInterval<Bound>, HalfOpenInterval<Bound>), (ClosedInterval<Bound>, ClosedInterval<Bound>), (ManagedBufferPointer<Value, Element>, ManagedBufferPointer<Value, Element>), (T?, T?), (T?, _OptionalNilComparisonType), (_OptionalNilComparisonType, T?), (Range<Element>, Range<Element>), (ReverseIndex<Base>, ReverseIndex<Base>), (UnsafeMutablePointer<Memory>, UnsafeMutablePointer<Memory>), (UnsafePointer<Memory>, UnsafePointer<Memory>), ((A, B), (A, B)), ((A, B, C), (A, B, C)), ((A, B, C, D), (A, B, C, D)), ((A, B, C, D, E), (A, B, C, D, E)), ((A, B, C, D, E, F), (A, B, C, D, E, F)), (Self, Self), (E, E.ValueType)\r\n                try expect(Mirror(reflecting: node.type).subjectType) == testType\r\n                                                                      ^\r\nmake: *** [.build/debug/test_runner] Error 1\r\n```\r\n\r\nTests could be even more readable if we could write something like `try expect(anObject).to.beTypeOf(AClass)` and `try expect(anObject).to.beProtocolOf(AProtocol)`. "}}