diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs index acf60cd6799..41327c988d2 100644 --- a/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs +++ b/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs @@ -224,8 +224,9 @@ impl<'a> FunctionContext<'a> { } fn codegen_string(&mut self, string: &str) -> Values { - let elements = - vecmap(string.as_bytes(), |byte| self.builder.field_constant(*byte as u128).into()); + let elements = vecmap(string.as_bytes(), |byte| { + self.builder.numeric_constant(*byte as u128, Type::unsigned(8)).into() + }); let typ = Self::convert_non_tuple_type(&ast::Type::String(elements.len() as u64)); self.codegen_array(elements, typ) } diff --git a/test_programs/execution_success/regression_3635/Nargo.toml b/test_programs/execution_success/regression_3635/Nargo.toml new file mode 100644 index 00000000000..4f34121439e --- /dev/null +++ b/test_programs/execution_success/regression_3635/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "regression_3635" +version = "0.1.0" +type = "bin" +authors = [""] + +[dependencies] diff --git a/test_programs/execution_success/regression_3635/Prover.toml b/test_programs/execution_success/regression_3635/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test_programs/execution_success/regression_3635/src/main.nr b/test_programs/execution_success/regression_3635/src/main.nr new file mode 100644 index 00000000000..97a04f9d93f --- /dev/null +++ b/test_programs/execution_success/regression_3635/src/main.nr @@ -0,0 +1,8 @@ +use dep::std; + +fn main() { + let x: u8 = 0x61; + let y: u8 = "a".as_bytes()[0]; + assert_eq(x, y); + assert_eq(x >> 1, y >> 1); +}