diff --git a/ast/src/errors/combiner.rs b/ast/src/errors/combiner.rs index 5a1022db27..8ad146d1cd 100644 --- a/ast/src/errors/combiner.rs +++ b/ast/src/errors/combiner.rs @@ -34,10 +34,4 @@ impl CombinerError { Self::new_from_span(message, span) } - - pub fn illegal_compound_array_range(span: &Span) -> Self { - let message = "Illegal compound assignement with array range".to_string(); - - Self::new_from_span(message, span) - } } diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index dca6f29aa8..c6355fc7b2 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -55,6 +55,14 @@ impl Canonicalizer { span: span.clone(), })); } + AssigneeAccess::ArrayRange(start, stop) => { + left = Box::new(Expression::ArrayRangeAccess(ArrayRangeAccessExpression { + array: left, + left: start.map(Box::new), + right: stop.map(Box::new), + span: span.clone(), + })); + } AssigneeAccess::Tuple(positive_number, _) => { left = Box::new(Expression::TupleAccess(TupleAccessExpression { tuple: left, @@ -69,7 +77,6 @@ impl Canonicalizer { span: span.clone(), })); } - _ => return Err(ReducerError::from(CombinerError::illegal_compound_array_range(&span))), } } diff --git a/compiler/src/statement/assign/assignee/array_index.rs b/compiler/src/statement/assign/assignee/array_index.rs index 36a086877c..0ef0007a0b 100644 --- a/compiler/src/statement/assign/assignee/array_index.rs +++ b/compiler/src/statement/assign/assignee/array_index.rs @@ -19,7 +19,7 @@ use std::convert::TryInto; use crate::{ - errors::{ExpressionError, IntegerError, StatementError}, + errors::{ExpressionError, StatementError}, program::ConstrainedProgram, value::ConstrainedValue, GroupType, @@ -55,9 +55,6 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { )) } else { let target = input.get_mut(index).unwrap(); - if let ConstrainedValue::Integer(int) = target { - println!("RTAAI T {}", int); - } if context.remaining_accesses.is_empty() { self.enforce_assign_context(cs, &context, target) } else { @@ -130,6 +127,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { _ => Err(StatementError::array_assign_interior_index(&context.span)), } } else if context.from_range && input_len != 0 { + context.from_range = false; if let Some(index) = index_resolved.to_usize() { if index >= input_len { return Err(StatementError::array_assign_index_bounds( @@ -147,12 +145,63 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { self.resolve_target_access(cs, context) } } else { + // index is input variable let span = index.span().cloned().unwrap_or_default(); + { + let array_len: u32 = context + .input + .len() + .try_into() + .map_err(|_| ExpressionError::array_length_out_of_bounds(&span))?; + self.array_bounds_check(cs, &&index_resolved, array_len, &span)?; + } - Err(StatementError::from(IntegerError::invalid_integer( - index_resolved.to_string(), - &span, - ))) + for (i, item) in context.input.iter_mut().enumerate() { + let namespace_string = format!( + "evaluate dyn array assignment eq {} {}:{}", + i, span.line_start, span.col_start + ); + let eq_namespace = cs.ns(|| namespace_string); + + let index_bounded = i + .try_into() + .map_err(|_| ExpressionError::array_index_out_of_legal_bounds(&span))?; + let const_index = ConstInt::U32(index_bounded).cast_to(&index_resolved.get_type()); + let index_comparison = index_resolved + .evaluate_equal(eq_namespace, &Integer::new(&const_index)) + .map_err(|_| ExpressionError::cannot_evaluate("==".to_string(), &span))?; + + let mut unique_namespace = cs.ns(|| { + format!( + "select array dyn assignment {} {}:{}", + i, span.line_start, span.col_start + ) + }); + let temp_item = { + let mut item = item.clone(); + let mut new_context = ResolverContext { + input: vec![&mut item], + span: context.span.clone(), + target_value: context.target_value.clone(), + remaining_accesses: context.remaining_accesses, + indicator: context.indicator, + operation: context.operation, + from_range: false, + }; + if context.remaining_accesses.is_empty() { + let item = new_context.input.remove(0); + self.enforce_assign_context(&mut unique_namespace, &new_context, item)?; + } else { + self.resolve_target_access(&mut unique_namespace, new_context)?; + } + item + }; + let value = + ConstrainedValue::conditionally_select(unique_namespace, &index_comparison, &temp_item, &item) + .map_err(|e| ExpressionError::cannot_enforce("conditional select".to_string(), e, &span))?; + **item = value; + } + Ok(()) } } else { Err(StatementError::array_assign_interior_index(&context.span)) diff --git a/compiler/src/statement/assign/assignee/array_range_index.rs b/compiler/src/statement/assign/assignee/array_range_index.rs index 38c1f80d56..3712a06382 100644 --- a/compiler/src/statement/assign/assignee/array_range_index.rs +++ b/compiler/src/statement/assign/assignee/array_range_index.rs @@ -32,8 +32,6 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { start: Option<&'a Expression<'a>>, stop: Option<&'a Expression<'a>>, ) -> Result<(), StatementError> { - context.from_range = true; - let start_index = start .map(|start| self.enforce_index(cs, start, &context.span)) .transpose()? @@ -52,8 +50,9 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { .transpose()?; let start_index = start_index.unwrap_or(0); - if context.input.len() == 1 { + if !context.from_range { // not a range of a range + context.from_range = true; match context.input.remove(0) { ConstrainedValue::Array(old) => { let stop_index = stop_index.unwrap_or(old.len()); diff --git a/compiler/tests/canonicalization/compound_assignment.json b/compiler/tests/canonicalization/compound_assignment.json index 562b29d0fd..f17e68bc1c 100644 --- a/compiler/tests/canonicalization/compound_assignment.json +++ b/compiler/tests/canonicalization/compound_assignment.json @@ -495,14 +495,14 @@ "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let y = [1u8, 2u8];\\\"}\"}", + "identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let y = [1u8, 2u8, 3, 4];\\\"}\"}", "span": { "line_start": 19, "line_stop": 19, "col_start": 7, "col_stop": 8, "path": "", - "content": " let y = [1u8, 2u8];" + "content": " let y = [1u8, 2u8, 3, 4];" } } ], @@ -522,7 +522,7 @@ "col_start": 12, "col_stop": 15, "path": "", - "content": " let y = [1u8, 2u8];" + "content": " let y = [1u8, 2u8, 3, 4];" } ] } @@ -540,7 +540,41 @@ "col_start": 17, "col_stop": 20, "path": "", - "content": " let y = [1u8, 2u8];" + "content": " let y = [1u8, 2u8, 3, 4];" + } + ] + } + } + }, + { + "Expression": { + "Value": { + "Implicit": [ + "3", + { + "line_start": 19, + "line_stop": 19, + "col_start": 22, + "col_stop": 23, + "path": "", + "content": " let y = [1u8, 2u8, 3, 4];" + } + ] + } + } + }, + { + "Expression": { + "Value": { + "Implicit": [ + "4", + { + "line_start": 19, + "line_stop": 19, + "col_start": 25, + "col_stop": 26, + "path": "", + "content": " let y = [1u8, 2u8, 3, 4];" } ] } @@ -551,9 +585,9 @@ "line_start": 19, "line_stop": 19, "col_start": 11, - "col_stop": 21, + "col_stop": 27, "path": "", - "content": " let y = [1u8, 2u8];" + "content": " let y = [1u8, 2u8, 3, 4];" } } }, @@ -561,9 +595,9 @@ "line_start": 19, "line_stop": 19, "col_start": 3, - "col_stop": 21, + "col_stop": 27, "path": "", - "content": " let y = [1u8, 2u8];" + "content": " let y = [1u8, 2u8, 3, 4];" } } }, @@ -669,6 +703,183 @@ } } }, + { + "Assign": { + "operation": "Assign", + "assignee": { + "identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y[0..3][1] *= 3;\\\"}\"}", + "accesses": [ + { + "ArrayRange": [ + { + "Value": { + "Implicit": [ + "0", + { + "line_start": 21, + "line_stop": 21, + "col_start": 5, + "col_stop": 6, + "path": "", + "content": " y[0..3][1] *= 3;" + } + ] + } + }, + { + "Value": { + "Implicit": [ + "3", + { + "line_start": 21, + "line_stop": 21, + "col_start": 8, + "col_stop": 9, + "path": "", + "content": " y[0..3][1] *= 3;" + } + ] + } + } + ] + }, + { + "ArrayIndex": { + "Value": { + "Implicit": [ + "1", + { + "line_start": 21, + "line_stop": 21, + "col_start": 11, + "col_stop": 12, + "path": "", + "content": " y[0..3][1] *= 3;" + } + ] + } + } + } + ], + "span": { + "line_start": 21, + "line_stop": 21, + "col_start": 3, + "col_stop": 13, + "path": "", + "content": " y[0..3][1] *= 3;" + } + }, + "value": { + "Binary": { + "left": { + "ArrayAccess": { + "array": { + "ArrayRangeAccess": { + "array": { + "Identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y[0..3][1] *= 3;\\\"}\"}" + }, + "left": { + "Value": { + "Implicit": [ + "0", + { + "line_start": 21, + "line_stop": 21, + "col_start": 5, + "col_stop": 6, + "path": "", + "content": " y[0..3][1] *= 3;" + } + ] + } + }, + "right": { + "Value": { + "Implicit": [ + "3", + { + "line_start": 21, + "line_stop": 21, + "col_start": 8, + "col_stop": 9, + "path": "", + "content": " y[0..3][1] *= 3;" + } + ] + } + }, + "span": { + "line_start": 21, + "line_stop": 21, + "col_start": 3, + "col_stop": 18, + "path": "", + "content": " y[0..3][1] *= 3;" + } + } + }, + "index": { + "Value": { + "Implicit": [ + "1", + { + "line_start": 21, + "line_stop": 21, + "col_start": 11, + "col_stop": 12, + "path": "", + "content": " y[0..3][1] *= 3;" + } + ] + } + }, + "span": { + "line_start": 21, + "line_stop": 21, + "col_start": 3, + "col_stop": 18, + "path": "", + "content": " y[0..3][1] *= 3;" + } + } + }, + "right": { + "Value": { + "Implicit": [ + "3", + { + "line_start": 21, + "line_stop": 21, + "col_start": 17, + "col_stop": 18, + "path": "", + "content": " y[0..3][1] *= 3;" + } + ] + } + }, + "op": "Mul", + "span": { + "line_start": 21, + "line_stop": 21, + "col_start": 3, + "col_stop": 18, + "path": "", + "content": " y[0..3][1] *= 3;" + } + } + }, + "span": { + "line_start": 21, + "line_stop": 21, + "col_start": 3, + "col_stop": 18, + "path": "", + "content": " y[0..3][1] *= 3;" + } + } + }, { "Console": { "function": { @@ -677,15 +888,15 @@ "left": { "ArrayAccess": { "array": { - "Identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(y[0] == 4u8);\\\"}\"}" + "Identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":22,\\\"line_stop\\\":22,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(y[0] == 4u8);\\\"}\"}" }, "index": { "Value": { "Implicit": [ "0", { - "line_start": 21, - "line_stop": 21, + "line_start": 22, + "line_stop": 22, "col_start": 20, "col_stop": 21, "path": "", @@ -695,8 +906,8 @@ } }, "span": { - "line_start": 21, - "line_stop": 21, + "line_start": 22, + "line_stop": 22, "col_start": 18, "col_stop": 22, "path": "", @@ -710,8 +921,8 @@ "U8", "4", { - "line_start": 21, - "line_stop": 21, + "line_start": 22, + "line_stop": 22, "col_start": 26, "col_stop": 29, "path": "", @@ -722,8 +933,8 @@ }, "op": "Eq", "span": { - "line_start": 21, - "line_stop": 21, + "line_start": 22, + "line_stop": 22, "col_start": 18, "col_stop": 29, "path": "", @@ -733,8 +944,8 @@ } }, "span": { - "line_start": 21, - "line_stop": 21, + "line_start": 22, + "line_stop": 22, "col_start": 3, "col_stop": 29, "path": "", @@ -742,16 +953,89 @@ } } }, + { + "Console": { + "function": { + "Assert": { + "Binary": { + "left": { + "ArrayAccess": { + "array": { + "Identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(y[1] == 6u8);\\\"}\"}" + }, + "index": { + "Value": { + "Implicit": [ + "1", + { + "line_start": 23, + "line_stop": 23, + "col_start": 20, + "col_stop": 21, + "path": "", + "content": " console.assert(y[1] == 6u8);" + } + ] + } + }, + "span": { + "line_start": 23, + "line_stop": 23, + "col_start": 18, + "col_stop": 22, + "path": "", + "content": " console.assert(y[1] == 6u8);" + } + } + }, + "right": { + "Value": { + "Integer": [ + "U8", + "6", + { + "line_start": 23, + "line_stop": 23, + "col_start": 26, + "col_stop": 29, + "path": "", + "content": " console.assert(y[1] == 6u8);" + } + ] + } + }, + "op": "Eq", + "span": { + "line_start": 23, + "line_stop": 23, + "col_start": 18, + "col_stop": 29, + "path": "", + "content": " console.assert(y[1] == 6u8);" + } + } + } + }, + "span": { + "line_start": 23, + "line_stop": 23, + "col_start": 3, + "col_stop": 29, + "path": "", + "content": " console.assert(y[1] == 6u8);" + } + } + }, { "Definition": { "declaration_type": "Let", "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let z = (1u8, 2u8);\\\"}\"}", + "identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let z = (1u8, 2u8);\\\"}\"}", "span": { - "line_start": 23, - "line_stop": 23, + "line_start": 25, + "line_stop": 25, "col_start": 7, "col_stop": 8, "path": "", @@ -769,8 +1053,8 @@ "U8", "1", { - "line_start": 23, - "line_stop": 23, + "line_start": 25, + "line_stop": 25, "col_start": 12, "col_stop": 15, "path": "", @@ -785,8 +1069,8 @@ "U8", "2", { - "line_start": 23, - "line_stop": 23, + "line_start": 25, + "line_stop": 25, "col_start": 17, "col_stop": 20, "path": "", @@ -797,8 +1081,8 @@ } ], "span": { - "line_start": 23, - "line_stop": 23, + "line_start": 25, + "line_stop": 25, "col_start": 11, "col_stop": 21, "path": "", @@ -807,8 +1091,8 @@ } }, "span": { - "line_start": 23, - "line_stop": 23, + "line_start": 25, + "line_stop": 25, "col_start": 3, "col_stop": 21, "path": "", @@ -820,7 +1104,7 @@ "Assign": { "operation": "Assign", "assignee": { - "identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" z.1 += 3u8;\\\"}\"}", + "identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":26,\\\"line_stop\\\":26,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" z.1 += 3u8;\\\"}\"}", "accesses": [ { "Tuple": [ @@ -828,8 +1112,8 @@ "value": "1" }, { - "line_start": 24, - "line_stop": 24, + "line_start": 26, + "line_stop": 26, "col_start": 3, "col_stop": 6, "path": "", @@ -839,8 +1123,8 @@ } ], "span": { - "line_start": 24, - "line_stop": 24, + "line_start": 26, + "line_stop": 26, "col_start": 3, "col_stop": 6, "path": "", @@ -852,14 +1136,14 @@ "left": { "TupleAccess": { "tuple": { - "Identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" z.1 += 3u8;\\\"}\"}" + "Identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":26,\\\"line_stop\\\":26,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" z.1 += 3u8;\\\"}\"}" }, "index": { "value": "1" }, "span": { - "line_start": 24, - "line_stop": 24, + "line_start": 26, + "line_stop": 26, "col_start": 3, "col_stop": 13, "path": "", @@ -873,8 +1157,8 @@ "U8", "3", { - "line_start": 24, - "line_stop": 24, + "line_start": 26, + "line_stop": 26, "col_start": 10, "col_stop": 13, "path": "", @@ -885,8 +1169,8 @@ }, "op": "Add", "span": { - "line_start": 24, - "line_stop": 24, + "line_start": 26, + "line_stop": 26, "col_start": 3, "col_stop": 13, "path": "", @@ -895,8 +1179,8 @@ } }, "span": { - "line_start": 24, - "line_stop": 24, + "line_start": 26, + "line_stop": 26, "col_start": 3, "col_stop": 13, "path": "", @@ -912,14 +1196,14 @@ "left": { "TupleAccess": { "tuple": { - "Identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(z.1 == 5u8);\\\"}\"}" + "Identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(z.1 == 5u8);\\\"}\"}" }, "index": { "value": "1" }, "span": { - "line_start": 25, - "line_stop": 25, + "line_start": 27, + "line_stop": 27, "col_start": 18, "col_stop": 21, "path": "", @@ -933,8 +1217,8 @@ "U8", "5", { - "line_start": 25, - "line_stop": 25, + "line_start": 27, + "line_stop": 27, "col_start": 25, "col_stop": 28, "path": "", @@ -945,8 +1229,8 @@ }, "op": "Eq", "span": { - "line_start": 25, - "line_stop": 25, + "line_start": 27, + "line_stop": 27, "col_start": 18, "col_stop": 28, "path": "", @@ -956,8 +1240,8 @@ } }, "span": { - "line_start": 25, - "line_stop": 25, + "line_start": 27, + "line_stop": 27, "col_start": 3, "col_stop": 28, "path": "", @@ -971,10 +1255,10 @@ "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":7,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", + "identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":7,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", "span": { - "line_start": 27, - "line_stop": 27, + "line_start": 29, + "line_stop": 29, "col_start": 7, "col_stop": 10, "path": "", @@ -985,18 +1269,18 @@ "type_": null, "value": { "CircuitInit": { - "name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", + "name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", "members": [ { - "identifier": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", + "identifier": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", "expression": { "Value": { "Integer": [ "U8", "6", { - "line_start": 27, - "line_stop": 27, + "line_start": 29, + "line_stop": 29, "col_start": 22, "col_stop": 25, "path": "", @@ -1007,7 +1291,7 @@ } }, { - "identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":27,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", + "identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":27,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", "expression": { "TupleInit": { "elements": [ @@ -1017,8 +1301,8 @@ "U8", "1", { - "line_start": 27, - "line_stop": 27, + "line_start": 29, + "line_stop": 29, "col_start": 31, "col_stop": 34, "path": "", @@ -1033,8 +1317,8 @@ "U8", "1", { - "line_start": 27, - "line_stop": 27, + "line_start": 29, + "line_stop": 29, "col_start": 36, "col_stop": 39, "path": "", @@ -1045,8 +1329,8 @@ } ], "span": { - "line_start": 27, - "line_stop": 27, + "line_start": 29, + "line_stop": 29, "col_start": 30, "col_stop": 40, "path": "", @@ -1057,8 +1341,8 @@ } ], "span": { - "line_start": 27, - "line_stop": 27, + "line_start": 29, + "line_stop": 29, "col_start": 13, "col_stop": 42, "path": "", @@ -1067,8 +1351,8 @@ } }, "span": { - "line_start": 27, - "line_stop": 27, + "line_start": 29, + "line_stop": 29, "col_start": 3, "col_stop": 42, "path": "", @@ -1080,15 +1364,15 @@ "Assign": { "operation": "Assign", "assignee": { - "identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":3,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}", + "identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":3,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}", "accesses": [ { - "Member": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}" + "Member": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}" } ], "span": { - "line_start": 28, - "line_stop": 28, + "line_start": 30, + "line_stop": 30, "col_start": 3, "col_stop": 8, "path": "", @@ -1100,12 +1384,12 @@ "left": { "CircuitMemberAccess": { "circuit": { - "Identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":3,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}" + "Identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":3,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}" }, - "name": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}", + "name": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}", "span": { - "line_start": 28, - "line_stop": 28, + "line_start": 30, + "line_stop": 30, "col_start": 3, "col_stop": 15, "path": "", @@ -1119,8 +1403,8 @@ "U8", "2", { - "line_start": 28, - "line_stop": 28, + "line_start": 30, + "line_stop": 30, "col_start": 12, "col_stop": 15, "path": "", @@ -1131,8 +1415,8 @@ }, "op": "Add", "span": { - "line_start": 28, - "line_stop": 28, + "line_start": 30, + "line_stop": 30, "col_start": 3, "col_stop": 15, "path": "", @@ -1141,8 +1425,8 @@ } }, "span": { - "line_start": 28, - "line_stop": 28, + "line_start": 30, + "line_stop": 30, "col_start": 3, "col_stop": 15, "path": "", @@ -1158,12 +1442,12 @@ "left": { "CircuitMemberAccess": { "circuit": { - "Identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(foo.f == 8u8);\\\"}\"}" + "Identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(foo.f == 8u8);\\\"}\"}" }, - "name": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":22,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(foo.f == 8u8);\\\"}\"}", + "name": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":22,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(foo.f == 8u8);\\\"}\"}", "span": { - "line_start": 29, - "line_stop": 29, + "line_start": 31, + "line_stop": 31, "col_start": 18, "col_stop": 23, "path": "", @@ -1177,8 +1461,8 @@ "U8", "8", { - "line_start": 29, - "line_stop": 29, + "line_start": 31, + "line_stop": 31, "col_start": 27, "col_stop": 30, "path": "", @@ -1189,8 +1473,8 @@ }, "op": "Eq", "span": { - "line_start": 29, - "line_stop": 29, + "line_start": 31, + "line_stop": 31, "col_start": 18, "col_stop": 30, "path": "", @@ -1200,8 +1484,8 @@ } }, "span": { - "line_start": 29, - "line_stop": 29, + "line_start": 31, + "line_stop": 31, "col_start": 3, "col_stop": 30, "path": "", @@ -1215,10 +1499,10 @@ "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":7,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let complex = 2u8;\\\"}\"}", + "identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":7,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let complex = 2u8;\\\"}\"}", "span": { - "line_start": 31, - "line_stop": 31, + "line_start": 33, + "line_stop": 33, "col_start": 7, "col_stop": 14, "path": "", @@ -1233,8 +1517,8 @@ "U8", "2", { - "line_start": 31, - "line_stop": 31, + "line_start": 33, + "line_stop": 33, "col_start": 17, "col_stop": 20, "path": "", @@ -1244,8 +1528,8 @@ } }, "span": { - "line_start": 31, - "line_stop": 31, + "line_start": 33, + "line_stop": 33, "col_start": 3, "col_stop": 20, "path": "", @@ -1257,11 +1541,11 @@ "Assign": { "operation": "Assign", "assignee": { - "identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":3,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" complex += 22u8 - 2u8+ 1u8;\\\"}\"}", + "identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":34,\\\"line_stop\\\":34,\\\"col_start\\\":3,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" complex += 22u8 - 2u8+ 1u8;\\\"}\"}", "accesses": [], "span": { - "line_start": 32, - "line_stop": 32, + "line_start": 34, + "line_stop": 34, "col_start": 3, "col_stop": 10, "path": "", @@ -1271,7 +1555,7 @@ "value": { "Binary": { "left": { - "Identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":3,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" complex += 22u8 - 2u8+ 1u8;\\\"}\"}" + "Identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":34,\\\"line_stop\\\":34,\\\"col_start\\\":3,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" complex += 22u8 - 2u8+ 1u8;\\\"}\"}" }, "right": { "Binary": { @@ -1283,8 +1567,8 @@ "U8", "22", { - "line_start": 32, - "line_stop": 32, + "line_start": 34, + "line_stop": 34, "col_start": 14, "col_stop": 18, "path": "", @@ -1299,8 +1583,8 @@ "U8", "2", { - "line_start": 32, - "line_stop": 32, + "line_start": 34, + "line_stop": 34, "col_start": 21, "col_stop": 24, "path": "", @@ -1311,8 +1595,8 @@ }, "op": "Sub", "span": { - "line_start": 32, - "line_stop": 32, + "line_start": 34, + "line_stop": 34, "col_start": 14, "col_stop": 24, "path": "", @@ -1326,8 +1610,8 @@ "U8", "1", { - "line_start": 32, - "line_stop": 32, + "line_start": 34, + "line_stop": 34, "col_start": 26, "col_stop": 29, "path": "", @@ -1338,8 +1622,8 @@ }, "op": "Add", "span": { - "line_start": 32, - "line_stop": 32, + "line_start": 34, + "line_stop": 34, "col_start": 14, "col_stop": 29, "path": "", @@ -1349,8 +1633,8 @@ }, "op": "Add", "span": { - "line_start": 32, - "line_stop": 32, + "line_start": 34, + "line_stop": 34, "col_start": 3, "col_stop": 29, "path": "", @@ -1359,8 +1643,8 @@ } }, "span": { - "line_start": 32, - "line_stop": 32, + "line_start": 34, + "line_stop": 34, "col_start": 3, "col_stop": 29, "path": "", @@ -1374,7 +1658,7 @@ "Assert": { "Binary": { "left": { - "Identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":18,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(complex == 23u8);\\\"}\"}" + "Identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":18,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(complex == 23u8);\\\"}\"}" }, "right": { "Value": { @@ -1382,8 +1666,8 @@ "U8", "23", { - "line_start": 33, - "line_stop": 33, + "line_start": 35, + "line_stop": 35, "col_start": 29, "col_stop": 33, "path": "", @@ -1394,8 +1678,8 @@ }, "op": "Eq", "span": { - "line_start": 33, - "line_stop": 33, + "line_start": 35, + "line_stop": 35, "col_start": 18, "col_stop": 33, "path": "", @@ -1405,8 +1689,8 @@ } }, "span": { - "line_start": 33, - "line_stop": 33, + "line_start": 35, + "line_stop": 35, "col_start": 3, "col_stop": 33, "path": "", @@ -1420,10 +1704,10 @@ "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":34,\\\"line_stop\\\":34,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let a = [[0u8; 1]; 4];\\\"}\"}", + "identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let a = [[0u8; 1]; 4];\\\"}\"}", "span": { - "line_start": 34, - "line_stop": 34, + "line_start": 36, + "line_stop": 36, "col_start": 7, "col_stop": 8, "path": "", @@ -1442,8 +1726,8 @@ "U8", "0", { - "line_start": 34, - "line_stop": 34, + "line_start": 36, + "line_stop": 36, "col_start": 13, "col_stop": 16, "path": "", @@ -1458,8 +1742,8 @@ } ], "span": { - "line_start": 34, - "line_stop": 34, + "line_start": 36, + "line_stop": 36, "col_start": 12, "col_stop": 20, "path": "", @@ -1473,8 +1757,8 @@ } ], "span": { - "line_start": 34, - "line_stop": 34, + "line_start": 36, + "line_stop": 36, "col_start": 11, "col_stop": 24, "path": "", @@ -1483,8 +1767,8 @@ } }, "span": { - "line_start": 34, - "line_stop": 34, + "line_start": 36, + "line_stop": 36, "col_start": 3, "col_stop": 24, "path": "", @@ -1496,7 +1780,7 @@ "Assign": { "operation": "Assign", "assignee": { - "identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" a[2][0] += 1u8;\\\"}\"}", + "identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":37,\\\"line_stop\\\":37,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" a[2][0] += 1u8;\\\"}\"}", "accesses": [ { "ArrayIndex": { @@ -1504,8 +1788,8 @@ "Implicit": [ "2", { - "line_start": 35, - "line_stop": 35, + "line_start": 37, + "line_stop": 37, "col_start": 5, "col_stop": 6, "path": "", @@ -1521,8 +1805,8 @@ "Implicit": [ "0", { - "line_start": 35, - "line_stop": 35, + "line_start": 37, + "line_stop": 37, "col_start": 8, "col_stop": 9, "path": "", @@ -1534,8 +1818,8 @@ } ], "span": { - "line_start": 35, - "line_stop": 35, + "line_start": 37, + "line_stop": 37, "col_start": 3, "col_stop": 10, "path": "", @@ -1549,15 +1833,15 @@ "array": { "ArrayAccess": { "array": { - "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" a[2][0] += 1u8;\\\"}\"}" + "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":37,\\\"line_stop\\\":37,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" a[2][0] += 1u8;\\\"}\"}" }, "index": { "Value": { "Implicit": [ "2", { - "line_start": 35, - "line_stop": 35, + "line_start": 37, + "line_stop": 37, "col_start": 5, "col_stop": 6, "path": "", @@ -1567,8 +1851,8 @@ } }, "span": { - "line_start": 35, - "line_stop": 35, + "line_start": 37, + "line_stop": 37, "col_start": 3, "col_stop": 17, "path": "", @@ -1581,8 +1865,8 @@ "Implicit": [ "0", { - "line_start": 35, - "line_stop": 35, + "line_start": 37, + "line_stop": 37, "col_start": 8, "col_stop": 9, "path": "", @@ -1592,8 +1876,8 @@ } }, "span": { - "line_start": 35, - "line_stop": 35, + "line_start": 37, + "line_stop": 37, "col_start": 3, "col_stop": 17, "path": "", @@ -1607,8 +1891,8 @@ "U8", "1", { - "line_start": 35, - "line_stop": 35, + "line_start": 37, + "line_stop": 37, "col_start": 14, "col_stop": 17, "path": "", @@ -1619,8 +1903,8 @@ }, "op": "Add", "span": { - "line_start": 35, - "line_stop": 35, + "line_start": 37, + "line_stop": 37, "col_start": 3, "col_stop": 17, "path": "", @@ -1629,8 +1913,8 @@ } }, "span": { - "line_start": 35, - "line_stop": 35, + "line_start": 37, + "line_stop": 37, "col_start": 3, "col_stop": 17, "path": "", @@ -1648,15 +1932,15 @@ "array": { "ArrayAccess": { "array": { - "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(a[2][0] == 1u8);\\\"}\"}" + "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":38,\\\"line_stop\\\":38,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(a[2][0] == 1u8);\\\"}\"}" }, "index": { "Value": { "Implicit": [ "2", { - "line_start": 36, - "line_stop": 36, + "line_start": 38, + "line_stop": 38, "col_start": 20, "col_stop": 21, "path": "", @@ -1666,8 +1950,8 @@ } }, "span": { - "line_start": 36, - "line_stop": 36, + "line_start": 38, + "line_stop": 38, "col_start": 18, "col_stop": 22, "path": "", @@ -1680,8 +1964,8 @@ "Implicit": [ "0", { - "line_start": 36, - "line_stop": 36, + "line_start": 38, + "line_stop": 38, "col_start": 23, "col_stop": 24, "path": "", @@ -1691,8 +1975,8 @@ } }, "span": { - "line_start": 36, - "line_stop": 36, + "line_start": 38, + "line_stop": 38, "col_start": 18, "col_stop": 25, "path": "", @@ -1706,8 +1990,8 @@ "U8", "1", { - "line_start": 36, - "line_stop": 36, + "line_start": 38, + "line_stop": 38, "col_start": 29, "col_stop": 32, "path": "", @@ -1718,8 +2002,8 @@ }, "op": "Eq", "span": { - "line_start": 36, - "line_stop": 36, + "line_start": 38, + "line_stop": 38, "col_start": 18, "col_stop": 32, "path": "", @@ -1729,8 +2013,8 @@ } }, "span": { - "line_start": 36, - "line_stop": 36, + "line_start": 38, + "line_stop": 38, "col_start": 3, "col_stop": 32, "path": "", @@ -1744,10 +2028,10 @@ "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":38,\\\"line_stop\\\":38,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let b = [0u8; (4, 1)];\\\"}\"}", + "identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":40,\\\"line_stop\\\":40,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let b = [0u8; (4, 1)];\\\"}\"}", "span": { - "line_start": 38, - "line_stop": 38, + "line_start": 40, + "line_stop": 40, "col_start": 7, "col_stop": 8, "path": "", @@ -1766,8 +2050,8 @@ "U8", "0", { - "line_start": 38, - "line_stop": 38, + "line_start": 40, + "line_stop": 40, "col_start": 12, "col_stop": 15, "path": "", @@ -1782,8 +2066,8 @@ } ], "span": { - "line_start": 38, - "line_stop": 38, + "line_start": 40, + "line_stop": 40, "col_start": 11, "col_stop": 24, "path": "", @@ -1797,8 +2081,8 @@ } ], "span": { - "line_start": 38, - "line_stop": 38, + "line_start": 40, + "line_stop": 40, "col_start": 11, "col_stop": 24, "path": "", @@ -1807,8 +2091,8 @@ } }, "span": { - "line_start": 38, - "line_stop": 38, + "line_start": 40, + "line_stop": 40, "col_start": 3, "col_stop": 24, "path": "", @@ -1820,7 +2104,7 @@ "Assign": { "operation": "Assign", "assignee": { - "identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":39,\\\"line_stop\\\":39,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" b[2][0] += 1u8;\\\"}\"}", + "identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":41,\\\"line_stop\\\":41,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" b[2][0] += 1u8;\\\"}\"}", "accesses": [ { "ArrayIndex": { @@ -1828,8 +2112,8 @@ "Implicit": [ "2", { - "line_start": 39, - "line_stop": 39, + "line_start": 41, + "line_stop": 41, "col_start": 5, "col_stop": 6, "path": "", @@ -1845,8 +2129,8 @@ "Implicit": [ "0", { - "line_start": 39, - "line_stop": 39, + "line_start": 41, + "line_stop": 41, "col_start": 8, "col_stop": 9, "path": "", @@ -1858,8 +2142,8 @@ } ], "span": { - "line_start": 39, - "line_stop": 39, + "line_start": 41, + "line_stop": 41, "col_start": 3, "col_stop": 10, "path": "", @@ -1873,15 +2157,15 @@ "array": { "ArrayAccess": { "array": { - "Identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":39,\\\"line_stop\\\":39,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" b[2][0] += 1u8;\\\"}\"}" + "Identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":41,\\\"line_stop\\\":41,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" b[2][0] += 1u8;\\\"}\"}" }, "index": { "Value": { "Implicit": [ "2", { - "line_start": 39, - "line_stop": 39, + "line_start": 41, + "line_stop": 41, "col_start": 5, "col_stop": 6, "path": "", @@ -1891,8 +2175,8 @@ } }, "span": { - "line_start": 39, - "line_stop": 39, + "line_start": 41, + "line_stop": 41, "col_start": 3, "col_stop": 17, "path": "", @@ -1905,8 +2189,8 @@ "Implicit": [ "0", { - "line_start": 39, - "line_stop": 39, + "line_start": 41, + "line_stop": 41, "col_start": 8, "col_stop": 9, "path": "", @@ -1916,8 +2200,8 @@ } }, "span": { - "line_start": 39, - "line_stop": 39, + "line_start": 41, + "line_stop": 41, "col_start": 3, "col_stop": 17, "path": "", @@ -1931,8 +2215,8 @@ "U8", "1", { - "line_start": 39, - "line_stop": 39, + "line_start": 41, + "line_stop": 41, "col_start": 14, "col_stop": 17, "path": "", @@ -1943,8 +2227,8 @@ }, "op": "Add", "span": { - "line_start": 39, - "line_stop": 39, + "line_start": 41, + "line_stop": 41, "col_start": 3, "col_stop": 17, "path": "", @@ -1953,8 +2237,8 @@ } }, "span": { - "line_start": 39, - "line_stop": 39, + "line_start": 41, + "line_stop": 41, "col_start": 3, "col_stop": 17, "path": "", @@ -1972,15 +2256,15 @@ "array": { "ArrayAccess": { "array": { - "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":40,\\\"line_stop\\\":40,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(a[2][0] == 1u8);\\\"}\"}" + "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":42,\\\"line_stop\\\":42,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(a[2][0] == 1u8);\\\"}\"}" }, "index": { "Value": { "Implicit": [ "2", { - "line_start": 40, - "line_stop": 40, + "line_start": 42, + "line_stop": 42, "col_start": 20, "col_stop": 21, "path": "", @@ -1990,8 +2274,8 @@ } }, "span": { - "line_start": 40, - "line_stop": 40, + "line_start": 42, + "line_stop": 42, "col_start": 18, "col_stop": 22, "path": "", @@ -2004,8 +2288,8 @@ "Implicit": [ "0", { - "line_start": 40, - "line_stop": 40, + "line_start": 42, + "line_stop": 42, "col_start": 23, "col_stop": 24, "path": "", @@ -2015,8 +2299,8 @@ } }, "span": { - "line_start": 40, - "line_stop": 40, + "line_start": 42, + "line_stop": 42, "col_start": 18, "col_stop": 25, "path": "", @@ -2030,8 +2314,8 @@ "U8", "1", { - "line_start": 40, - "line_stop": 40, + "line_start": 42, + "line_stop": 42, "col_start": 29, "col_stop": 32, "path": "", @@ -2042,8 +2326,8 @@ }, "op": "Eq", "span": { - "line_start": 40, - "line_stop": 40, + "line_start": 42, + "line_stop": 42, "col_start": 18, "col_stop": 32, "path": "", @@ -2053,8 +2337,8 @@ } }, "span": { - "line_start": 40, - "line_stop": 40, + "line_start": 42, + "line_stop": 42, "col_start": 3, "col_stop": 32, "path": "", @@ -2065,7 +2349,7 @@ ], "span": { "line_start": 10, - "line_stop": 41, + "line_stop": 43, "col_start": 17, "col_stop": 2, "path": "", @@ -2074,11 +2358,11 @@ }, "span": { "line_start": 10, - "line_stop": 41, + "line_stop": 43, "col_start": 1, "col_stop": 2, "path": "", - "content": "function main() {\n...\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + "content": "function main() {\n...\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" } } } diff --git a/compiler/tests/canonicalization/compound_assignment.leo b/compiler/tests/canonicalization/compound_assignment.leo index 6fe7a58b5c..f513cd3c41 100644 --- a/compiler/tests/canonicalization/compound_assignment.leo +++ b/compiler/tests/canonicalization/compound_assignment.leo @@ -16,9 +16,11 @@ function main() { w += x; console.assert(w == 33u32); - let y = [1u8, 2u8]; + let y = [1u8, 2u8, 3, 4]; y[0] += 3u8; + y[0..3][1] *= 3; console.assert(y[0] == 4u8); + console.assert(y[1] == 6u8); let z = (1u8, 2u8); z.1 += 3u8; diff --git a/tests/compiler/array/complex_access.leo b/tests/compiler/array/complex_access.leo index 91cece47f5..4e68ad1c57 100644 --- a/tests/compiler/array/complex_access.leo +++ b/tests/compiler/array/complex_access.leo @@ -5,19 +5,26 @@ input_file: - input/complex_access.in */ -function main (a: [u8; 8], b: [[u8; 3]; 3], c: [(u8, u32); 1]) -> bool { +function main (a: [u8; 8], b: u32, c: [[u8; 3]; 3], d: [(u8, u32); 1], e: [u8; (3, 4)] ) -> bool { + a[0..3][b] = 93; a[2..6][1] = 87; + a[2..6][1] *= 2; a[2..3] = [42u8]; a[6..][0] = 43u8; + a[0..1][0..1] = [200]; - b[0..2][0] = [1u8; 3]; - b[1..][1][1..2][0] = 126; - b[1..][0] = [42, 43, 44]; + c[0..2][0] = [1u8; 3]; + c[1..][1][1..2][0] = 126; + c[1..][0] = [42, 43, 44]; - c[..1][0].1 = 1; + d[..1][0].1 = 1; + + e[0..][0] = [22; 4]; + e[0..][0][0] = 33; return - a == [1u8, 2, 42, 87, 5, 6, 43, 8] - && b == [[1u8, 1, 1], [42, 43, 44], [7, 126, 9]] - && c == [(0u8, 1u32)]; + a == [200u8, 93, 42, 174, 5, 6, 43, 8] + && c == [[1u8, 1, 1], [42, 43, 44], [7, 126, 9]] + && d == [(0u8, 1u32)] + && e == [[33u8, 22, 22, 22], [0, 0, 0, 0], [0, 0, 0, 0]]; } \ No newline at end of file diff --git a/tests/compiler/array/input/complex_access.in b/tests/compiler/array/input/complex_access.in index 911a174e73..41b2dfabb4 100644 --- a/tests/compiler/array/input/complex_access.in +++ b/tests/compiler/array/input/complex_access.in @@ -1,7 +1,9 @@ [main] a: [u8; 8] = [1u8, 2, 3, 4, 5, 6, 7, 8]; -b: [[u8; 3]; 3] = [[1u8, 2, 3], [4, 5, 6], [7, 8, 9]]; -c: [(u8, u32); 1] = [(0u8, 0u32)]; +b: u32 = 1; +c: [[u8; 3]; 3] = [[1u8, 2, 3], [4, 5, 6], [7, 8, 9]]; +d: [(u8, u32); 1] = [(0u8, 0u32)]; +e: [u8; (3, 4)] = [0u8; (3, 4)]; [registers] out: bool = true; \ No newline at end of file diff --git a/tests/expectations/compiler/compiler/array/complex_access.leo.out b/tests/expectations/compiler/compiler/array/complex_access.leo.out index 471ffe9965..98d328c716 100644 --- a/tests/expectations/compiler/compiler/array/complex_access.leo.out +++ b/tests/expectations/compiler/compiler/array/complex_access.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 239 - num_constraints: 239 - at: 61be39f73914fdb4059c5d5e5776840262ab56dc414aa09106ddfee1d27ba174 - bt: 3f2d18346ecde92782f60a29649e187402d8f2059cf934b31f5606c4d4381883 - ct: db5fb9e237a13bca372ce7d3f232661fdf07c8ae7ef3d99517438a3532f59a41 + num_private_variables: 637 + num_constraints: 662 + at: 9f1bcfcac007139af57f04172704330d348767a9c51fe8ce15fb60f457fa6337 + bt: b6500ddf37d10958fdc014dcb2f54b37a2c684f05b7f0aa4776556331db8c924 + ct: a15c712d74487a80767116103c38fa7277066705d0c7f1f9902a6016466706f0 output: - input_file: input/complex_access.in output: