1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

UnannotatedTerm is Comparable.

This commit is contained in:
Rob Rix 2015-10-19 10:50:19 -04:00
parent df0ba4c10e
commit 6e376d9d51

View File

@ -1,4 +1,4 @@
struct UnannotatedTerm: Equatable {
struct UnannotatedTerm: Comparable {
typealias Term = Cofree<String, ()>
let term: Term
@ -71,6 +71,10 @@ func == (left: UnannotatedTerm, right: UnannotatedTerm) -> Bool {
return UnannotatedTerm.Term.equals(annotation: const(true), leaf: ==)(left.term, right.term)
}
func < (left: UnannotatedTerm, right: UnannotatedTerm) -> Bool {
return left.term.size < right.term.size
}
extension UnannotatedTerm: Arbitrary {
static func arbitrary(k: Int) -> Gen<UnannotatedTerm> {