Skip to content

Commit 09d32c6

Browse files
committed
Make GraphQLType conform to Hashable
1 parent 3933850 commit 09d32c6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/GraphQL/Type/Definition.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import NIO
44
/**
55
* These are all of the possible kinds of types.
66
*/
7-
public protocol GraphQLType : CustomDebugStringConvertible, Encodable, KeySubscriptable, AnyObject, Equatable {}
7+
public protocol GraphQLType : CustomDebugStringConvertible, Encodable, KeySubscriptable, AnyObject, Hashable {}
88
extension GraphQLScalarType : GraphQLType {}
99
extension GraphQLObjectType : GraphQLType {}
1010
extension GraphQLInterfaceType : GraphQLType {}
@@ -16,7 +16,11 @@ extension GraphQLNonNull : GraphQLType {}
1616

1717
extension GraphQLType {
1818
public static func == (lhs: Self, rhs: Self) -> Bool {
19-
ObjectIdentifier(lhs) == ObjectIdentifier(rhs)
19+
lhs === rhs
20+
}
21+
22+
public func hash(into hasher: inout Hasher) {
23+
ObjectIdentifier(self).hash(into: &hasher)
2024
}
2125
}
2226

0 commit comments

Comments
 (0)