The documentation of Language::discriminant says the following:
Type representing the cases of this language.
Used for short-circuiting the search for equivalent nodes.
Return the Discriminant of this node.
What properties must this discriminant uphold?
From a quick look at the code, I am inferring that it must:
- Be compatible with
Language::matches: if a.matches(b) then a.discriminant() == b.discriminant() (and not necessarily the reciprocal)
- Be compatible with
Ord: if a.discriminant() == c.discriminant() && a < b && b < c then a.discriminant() == b.discriminant()
Are there other requirements?