Repository: microsoft/regorus (language: python)

Issue:
Errors in parameters not propagated correctly
In the following, when evaluating `data.test.foo`, the error raised by evaluation of `bar` is ignored. Instead, the error manifests differently (incorrect number of arguments passed to count).

```rego
        package test
        import rego.v1

        bar := 1 if {
          1 + "hello"
        }
        foo := 1 if {
          count(bar)
        }
```




Discussion / hints:

Fix patch:
diff --git a/src/interpreter.rs b/src/interpreter.rs
index 9453f9c3..6031757c 100644
--- a/src/interpreter.rs
+++ b/src/interpreter.rs
@@ -2283,15 +2283,8 @@ impl Interpreter {
         };
 
         let mut param_values = Vec::with_capacity(params.len());
-        let mut error = None;
         for p in params {
-            match self.eval_expr(p) {
-                Ok(v) => param_values.push(v),
-                Err(e) => {
-                    error = Some(Err(e));
-                    break;
-                }
-            }
+            param_values.push(self.eval_expr(p)?);
         }
 
         let orig_fcn_path = fcn_path;
@@ -2308,9 +2301,6 @@ impl Interpreter {
                 if param_values.iter().any(|v| v == &Value::Undefined) {
                     return Ok(Value::Undefined);
                 }
-                if let Some(err) = error {
-                    err?;
-                };
                 return Ok(v.clone());
             }
             _ => orig_fcn_path.clone(),


Test patch:
diff --git a/tests/interpreter/cases/call/basic.yaml b/tests/interpreter/cases/call/basic.yaml
index 012df0d6..cd8ae64c 100644
--- a/tests/interpreter/cases/call/basic.yaml
+++ b/tests/interpreter/cases/call/basic.yaml
@@ -59,3 +59,20 @@ cases:
         a1 = inc(5)
     query: data.test
     want_result: {}
+
+  - note: call parameter raises error
+    data: {}
+    modules:
+      - |
+        package test
+        import rego.v1
+        
+        bar := 1 if {
+          1 + "hello"
+        }
+        foo := 1 if {
+          count(bar)
+        }
+    query: data.test
+    error: expects numeric argument.
+