Allow union lambdas to have duplicates

This commit is contained in:
Ayaz Hafiz 2022-06-27 13:07:22 -04:00 committed by ayazhafiz
parent 8fb9ccccfe
commit ca87faa906
No known key found for this signature in database
GPG key ID: B443F7A3030C9AED
2 changed files with 7 additions and 4 deletions

View file

@ -2650,11 +2650,14 @@ impl<L> UnionLabels<L>
where
L: Label + Ord,
{
pub fn is_sorted_no_duplicates(&self, subs: &Subs) -> bool {
/// Checks if the union of labels is sorted by label.
/// Duplicates *are* admitted, since this represents a lambda set, in which we may have
/// duplicate lambda captures, if those lambda captures have different representations!
pub fn is_sorted(&self, subs: &Subs) -> bool {
let mut iter = self.iter_from_subs(subs).peekable();
while let Some((before, _)) = iter.next() {
if let Some((after, _)) = iter.peek() {
if before >= after {
if before > after {
return false;
}
}