diff --git a/crates/jrsonnet-evaluator/src/error.rs b/crates/jrsonnet-evaluator/src/error.rs index 37100a48..5b718c8f 100644 --- a/crates/jrsonnet-evaluator/src/error.rs +++ b/crates/jrsonnet-evaluator/src/error.rs @@ -24,7 +24,12 @@ pub(crate) fn format_found(list: &[IStr], what: &str) -> String { return String::new(); } let mut out = String::new(); - out.push_str("\nThere is "); + out.push_str("\nThere "); + if list.len() > 1 { + out.push_str("are "); + } else { + out.push_str("is a "); + } out.push_str(what); if list.len() > 1 { out.push('s'); @@ -133,7 +138,7 @@ pub enum ErrorKind { #[error("assert failed: {}", format_empty_str(.0))] AssertionFailed(IStr), - #[error("variable is not defined: {0}{}", format_found(.1, "variable"))] + #[error("local is not defined: {0}{}", format_found(.1, "local"))] VariableIsNotDefined(IStr, Vec), #[error("duplicate local var: {0}")] DuplicateLocalVar(IStr), diff --git a/crates/jrsonnet-evaluator/src/evaluate/mod.rs b/crates/jrsonnet-evaluator/src/evaluate/mod.rs index 823adbf3..df414745 100644 --- a/crates/jrsonnet-evaluator/src/evaluate/mod.rs +++ b/crates/jrsonnet-evaluator/src/evaluate/mod.rs @@ -464,7 +464,7 @@ pub fn evaluate(ctx: Context, expr: &LocExpr) -> Result { UnaryOp(o, v) => evaluate_unary_op(*o, &evaluate(ctx, v)?)?, Var(name) => in_frame( CallLocation::new(&loc), - || format!("variable <{name}> access"), + || format!("local <{name}> access"), || ctx.binding(name.clone())?.evaluate(), )?, Index { indexable, parts } => ensure_sufficient_stack(|| {