mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-30 18:03:46 +00:00
Allow union lambdas to have duplicates
This commit is contained in:
parent
8fb9ccccfe
commit
ca87faa906
2 changed files with 7 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue