Diff Coverage

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

Source File Diff Coverage (%) Missing Lines
crates/conjure-cp-essence-parser/src/parser/atom.rs 60.0% 189,194
crates/conjure-cp-essence-parser/src/parser/expression.rs 81.0% 120,177,179,182
crates/conjure-cp-essence-parser/tests/unexpected_token.rs 100%  
crates/conjure-cp-essence-parser/src/parser/atom.rs
185
186
187
188
189
190
191
192
193
194
195
196
197
    match node.kind() {
        "arithmetic_expr" | "atom" => {
            let saved_context = ctx.typechecking_context;
            ctx.typechecking_context = TypecheckingContext::Unknown;

            // TODO: add collection-aware index typechecking.
            // For tuple/matrix/set-like indexing, indices should be arithmetic.
            // For record field access, index atoms should resolve to valid field names.
            // This requires checking index expression together with the indexed collection type.

            let Some(expr) = parse_expression(ctx, *node)? else {
                return Ok(None);
            };
crates/conjure-cp-essence-parser/src/parser/expression.rs
116
117
118
119
120
121
122
123
124
        "all_diff_comparison" => {
            // TODO: check that operand is a collection with compatible element type.
            ctx.typechecking_context = TypecheckingContext::Unknown;
            parse_all_diff_comparison(ctx, &inner)
        }
        _ => Err(FatalParseError::internal_error(
            format!("Expected comparison expression, found '{}'", inner.kind()),
            Some(inner.range()),
        )),
173
174
175
176
177
178
179
180
181
182
183
184
185
186
    ctx: &mut ParseContext,
    node: &Node,
) -> Result<Option<Expression>, FatalParseError> {
    let Some(inner) = parse_expression(ctx, field!(node, "arg"))? else {
        return Ok(None);
    };

    Ok(Some(Expression::AllDiff(Metadata::new(), Moo::new(inner))))
}

fn parse_unary_expression(
    ctx: &mut ParseContext,
    node: &Node,
) -> Result<Option<Expression>, FatalParseError> {