Diff Coverage

Diff: upstream/main...HEAD, staged and unstaged changes

Source File Diff Coverage (%) Missing Lines
crates/conjure-cp-core/src/ast/expressions.rs 0.0% 666,668-672,675-680,682-687
crates/conjure-cp-core/src/ast/expressions.rs
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
impl Expression {
    /// Returns the possible values of the expression, recursing to leaf expressions
    pub fn domain_of(&self) -> Option<DomainPtr> {
        match self {
            Expression::Union(_, a, b) => {
                // Ascertain range
                let (a_attr, _) = a.domain_of()?.as_set()?;
                let (b_attr, _) = b.domain_of()?.as_set()?;
                let a_range = a_attr.resolve()?.size;
                let b_range = b_attr.resolve()?.size;
                let new_range = Range::spanning(&[a_range, b_range]);

                // Create
                Some(Domain::set(
                    SetAttr::new(new_range),
                    a.domain_of()?.union(&b.domain_of()?).ok()?,
                ))
            }
            Expression::Intersect(_, a, b) => {
                // thinking about Range::overlaps?

                Some(Domain::set(
                    SetAttr::<IntVal>::default(),
                    a.domain_of()?.intersect(&b.domain_of()?).ok()?,
                ))
            }
            Expression::In(_, _, _) => Some(Domain::bool()),
            Expression::Supset(_, _, _) => Some(Domain::bool()),
            Expression::SupsetEq(_, _, _) => Some(Domain::bool()),
            Expression::Subset(_, _, _) => Some(Domain::bool()),