Browse Source

Enforce that public Scalar equality statements only work on non-vector variables

Ian Goldberg 4 months ago
parent
commit
c961d683a0
1 changed files with 13 additions and 4 deletions
  1. 13 4
      sigma_compiler_core/src/pubscalareq.rs

+ 13 - 4
sigma_compiler_core/src/pubscalareq.rs

@@ -46,11 +46,20 @@ pub fn transform(
             if let Expr::Path(syn::ExprPath { path, .. }) = left.as_ref() {
                 if let Some(id) = path.get_ident() {
                     let idstr = id.to_string();
-                    if let Some(TaggedIdent::Scalar(TaggedScalar { is_pub: true, .. })) =
-                        vars.get(&idstr)
+                    if let Some(TaggedIdent::Scalar(TaggedScalar {
+                        is_pub: true,
+                        is_vec: false,
+                        ..
+                    })) = vars.get(&idstr)
                     {
-                        if let (AExprType::Scalar { is_pub: true, .. }, right_tokens) =
-                            expr_type_tokens(&vardict, right)?
+                        if let (
+                            AExprType::Scalar {
+                                is_pub: true,
+                                is_vec: false,
+                                ..
+                            },
+                            right_tokens,
+                        ) = expr_type_tokens(&vardict, right)?
                         {
                             // We found a public Scalar equality
                             // statement.  Add code to both the prover