diff --git a/asg/src/statement/definition.rs b/asg/src/statement/definition.rs index 846e34cc3a..d704309925 100644 --- a/asg/src/statement/definition.rs +++ b/asg/src/statement/definition.rs @@ -28,6 +28,7 @@ use crate::{ Type, Variable, }; +use leo_ast::{AstError, DeprecatedError}; use std::cell::{Cell, RefCell}; @@ -89,8 +90,10 @@ impl<'a> FromAst<'a, leo_ast::DefinitionStatement> for &'a Statement<'a> { } for (variable, type_) in statement.variable_names.iter().zip(output_types.into_iter()) { - if statement.declaration_type == leo_ast::Declare::Const && variable.mutable { - return Err(AsgConvertError::illegal_ast_structure("cannot have const mut")); + if statement.declaration_type == leo_ast::Declare::Const { + return Err(AsgConvertError::AstError(AstError::DeprecatedError( + DeprecatedError::const_statement(&statement.span), + ))); } variables.push(&*scope.alloc_variable(RefCell::new(InnerVariable { id: uuid::Uuid::new_v4(), diff --git a/asg/tests/fail/array/nested_3x2_value_fail.leo b/asg/tests/fail/array/nested_3x2_value_fail.leo index a187a51991..35c8478cd1 100644 --- a/asg/tests/fail/array/nested_3x2_value_fail.leo +++ b/asg/tests/fail/array/nested_3x2_value_fail.leo @@ -1,4 +1,4 @@ // Multidimensional array syntax in leo function main() { - const a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) + let a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) } diff --git a/asg/tests/fail/array/tuple_3x2_value_fail.leo b/asg/tests/fail/array/tuple_3x2_value_fail.leo index 78593ab696..42e6f61500 100644 --- a/asg/tests/fail/array/tuple_3x2_value_fail.leo +++ b/asg/tests/fail/array/tuple_3x2_value_fail.leo @@ -1,4 +1,4 @@ // Multidimensional array syntax in leo function main() { - const a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) + let a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) } diff --git a/asg/tests/fail/array/type_nested_value_nested_3x2_fail.leo b/asg/tests/fail/array/type_nested_value_nested_3x2_fail.leo index 56c8916fb0..4bd07f85db 100644 --- a/asg/tests/fail/array/type_nested_value_nested_3x2_fail.leo +++ b/asg/tests/fail/array/type_nested_value_nested_3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) + let b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/asg/tests/fail/array/type_nested_value_nested_4x3x2_fail.leo b/asg/tests/fail/array/type_nested_value_nested_4x3x2_fail.leo index 480327a91d..6479004d68 100644 --- a/asg/tests/fail/array/type_nested_value_nested_4x3x2_fail.leo +++ b/asg/tests/fail/array/type_nested_value_nested_4x3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) + let b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/asg/tests/fail/array/type_nested_value_tuple_3x2_fail.leo b/asg/tests/fail/array/type_nested_value_tuple_3x2_fail.leo index 3bfb559615..ba99b070c7 100644 --- a/asg/tests/fail/array/type_nested_value_tuple_3x2_fail.leo +++ b/asg/tests/fail/array/type_nested_value_tuple_3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) + let b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/asg/tests/fail/array/type_nested_value_tuple_4x3x2_fail.leo b/asg/tests/fail/array/type_nested_value_tuple_4x3x2_fail.leo index ce1219a37b..95172bf329 100644 --- a/asg/tests/fail/array/type_nested_value_tuple_4x3x2_fail.leo +++ b/asg/tests/fail/array/type_nested_value_tuple_4x3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering) + let b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/asg/tests/fail/array/type_tuple_value_nested_3x2_fail.leo b/asg/tests/fail/array/type_tuple_value_nested_3x2_fail.leo index e84f025a9f..9732cf26ef 100644 --- a/asg/tests/fail/array/type_tuple_value_nested_3x2_fail.leo +++ b/asg/tests/fail/array/type_tuple_value_nested_3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering) + let b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/asg/tests/fail/array/type_tuple_value_nested_3x2_swap_fail.leo b/asg/tests/fail/array/type_tuple_value_nested_3x2_swap_fail.leo index 0b960c6b44..6edfa83847 100644 --- a/asg/tests/fail/array/type_tuple_value_nested_3x2_swap_fail.leo +++ b/asg/tests/fail/array/type_tuple_value_nested_3x2_swap_fail.leo @@ -1,7 +1,7 @@ function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - const b: [u8; (2, 3)] = [[0; 3]; 2]; // initializer + let b: [u8; (2, 3)] = [[0; 3]; 2]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/fail/array/type_tuple_value_nested_4x3x2_fail.leo b/asg/tests/fail/array/type_tuple_value_nested_4x3x2_fail.leo index cbb7ccbf76..b820c4d088 100644 --- a/asg/tests/fail/array/type_tuple_value_nested_4x3x2_fail.leo +++ b/asg/tests/fail/array/type_tuple_value_nested_4x3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) + let b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/asg/tests/fail/array/type_tuple_value_tuple_3x2_fail.leo b/asg/tests/fail/array/type_tuple_value_tuple_3x2_fail.leo index 884a75db9d..99487ccb7a 100644 --- a/asg/tests/fail/array/type_tuple_value_tuple_3x2_fail.leo +++ b/asg/tests/fail/array/type_tuple_value_tuple_3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering) + let b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/asg/tests/fail/array/type_tuple_value_tuple_3x2_swap_fail.leo b/asg/tests/fail/array/type_tuple_value_tuple_3x2_swap_fail.leo index d742a544a7..40f1ca9933 100644 --- a/asg/tests/fail/array/type_tuple_value_tuple_3x2_swap_fail.leo +++ b/asg/tests/fail/array/type_tuple_value_tuple_3x2_swap_fail.leo @@ -1,7 +1,7 @@ function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - const b: [u8; (2, 3)] = [0; (2, 3)]; // initializer + let b: [u8; (2, 3)] = [0; (2, 3)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/fail/array/type_tuple_value_tuple_4x3x2_fail.leo b/asg/tests/fail/array/type_tuple_value_tuple_4x3x2_fail.leo index 31e2a5e552..824fd90bc6 100644 --- a/asg/tests/fail/array/type_tuple_value_tuple_4x3x2_fail.leo +++ b/asg/tests/fail/array/type_tuple_value_tuple_4x3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order) + let b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order) } \ No newline at end of file diff --git a/asg/tests/fail/function/scope_fail.leo b/asg/tests/fail/function/scope_fail.leo index ac6bfcad37..773c2479d7 100644 --- a/asg/tests/fail/function/scope_fail.leo +++ b/asg/tests/fail/function/scope_fail.leo @@ -3,6 +3,6 @@ function foo() -> field { } function main() { - const myGlobal = 42field; + let myGlobal = 42field; let err = foo(); } \ No newline at end of file diff --git a/asg/tests/fail/mutability/const.leo b/asg/tests/fail/mutability/const.leo index 44f9279085..d2a3a6ac2b 100644 --- a/asg/tests/fail/mutability/const.leo +++ b/asg/tests/fail/mutability/const.leo @@ -1,5 +1,5 @@ -// Constant variables are immutable by default. +// Let variables are immutable by default. function main() { - const a = 1u32; + let a = 1u32; a = 0; } \ No newline at end of file diff --git a/asg/tests/fail/mutability/const_mut.leo b/asg/tests/fail/mutability/const_mut.leo deleted file mode 100644 index ef194ae178..0000000000 --- a/asg/tests/fail/mutability/const_mut.leo +++ /dev/null @@ -1,4 +0,0 @@ -// Adding the `mut` keyword to a constant variable is illegal -function main() { - const mut a = 1u32; -} \ No newline at end of file diff --git a/asg/tests/fail/statements/const_declaration_fail.leo b/asg/tests/fail/statements/const_declaration_fail.leo new file mode 100644 index 0000000000..1c7afb178a --- /dev/null +++ b/asg/tests/fail/statements/const_declaration_fail.leo @@ -0,0 +1,3 @@ +function main() { + const x = 1u32; +} \ No newline at end of file diff --git a/asg/tests/fail/statements/mod.rs b/asg/tests/fail/statements/mod.rs index f12ed3e983..866d59d1bd 100644 --- a/asg/tests/fail/statements/mod.rs +++ b/asg/tests/fail/statements/mod.rs @@ -23,3 +23,9 @@ fn test_num_returns_fail() { let program_string = include_str!("num_returns_fail.leo"); load_asg(&new_context(), program_string).err().unwrap(); } + +#[test] +fn test_const_declaration_fail() { + let program_string = include_str!("const_declaration_fail.leo"); + load_asg(program_string).err().unwrap(); +} diff --git a/asg/tests/pass/array/multi_initializer.leo b/asg/tests/pass/array/multi_initializer.leo index 6133542ef0..7257999ddf 100644 --- a/asg/tests/pass/array/multi_initializer.leo +++ b/asg/tests/pass/array/multi_initializer.leo @@ -1,7 +1,7 @@ function main() { - const a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)]; + let a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)]; - const b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2]; + let b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2]; console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/nested_3x2_value.leo b/asg/tests/pass/array/nested_3x2_value.leo index c5f64c997e..b69ddffb89 100644 --- a/asg/tests/pass/array/nested_3x2_value.leo +++ b/asg/tests/pass/array/nested_3x2_value.leo @@ -1,8 +1,8 @@ // Multidimensional array syntax in leo function main() { - const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline + let a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline - const b: [u32; (3, 2)] = [[0; 2]; 3]; // initializer + let b: [u32; (3, 2)] = [[0; 2]; 3]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/tuple_3x2_value.leo b/asg/tests/pass/array/tuple_3x2_value.leo index b6659539d5..dc9128c51e 100644 --- a/asg/tests/pass/array/tuple_3x2_value.leo +++ b/asg/tests/pass/array/tuple_3x2_value.leo @@ -1,8 +1,8 @@ // Multidimensional array syntax in leo function main() { - const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline + let a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline - const b: [u32; (3, 2)] = [0; (3, 2)]; // initializer + let b: [u32; (3, 2)] = [0; (3, 2)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/type_input_3x2.leo b/asg/tests/pass/array/type_input_3x2.leo index ea60a0cc24..40781415c1 100644 --- a/asg/tests/pass/array/type_input_3x2.leo +++ b/asg/tests/pass/array/type_input_3x2.leo @@ -1,5 +1,5 @@ function main(a: [[u8; 2]; 3]) { - const b = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let b = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/type_input_4x3x2.leo b/asg/tests/pass/array/type_input_4x3x2.leo index 2d9c4cff22..bd75514904 100644 --- a/asg/tests/pass/array/type_input_4x3x2.leo +++ b/asg/tests/pass/array/type_input_4x3x2.leo @@ -1,5 +1,5 @@ function main(a: [[[u8; 2]; 3]; 4]) { - const b = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], + let b = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline diff --git a/asg/tests/pass/array/type_nested_value_nested_3x2.leo b/asg/tests/pass/array/type_nested_value_nested_3x2.leo index bcf5bae674..341b9ead9c 100644 --- a/asg/tests/pass/array/type_nested_value_nested_3x2.leo +++ b/asg/tests/pass/array/type_nested_value_nested_3x2.leo @@ -1,7 +1,7 @@ function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - const b: [[u8; 2]; 3] = [[0; 2]; 3]; // initializer + let b: [[u8; 2]; 3] = [[0; 2]; 3]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/type_nested_value_nested_4x3x2.leo b/asg/tests/pass/array/type_nested_value_nested_4x3x2.leo index 1691fa26c7..5ba24a381b 100644 --- a/asg/tests/pass/array/type_nested_value_nested_4x3x2.leo +++ b/asg/tests/pass/array/type_nested_value_nested_4x3x2.leo @@ -1,10 +1,10 @@ function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], + let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - const b: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; // initializer + let b: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/type_nested_value_tuple_3x2.leo b/asg/tests/pass/array/type_nested_value_tuple_3x2.leo index 5f14084d55..c6fac9ec64 100644 --- a/asg/tests/pass/array/type_nested_value_tuple_3x2.leo +++ b/asg/tests/pass/array/type_nested_value_tuple_3x2.leo @@ -1,7 +1,7 @@ function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - const b: [[u8; 2]; 3] = [0; (3, 2)]; // initializer + let b: [[u8; 2]; 3] = [0; (3, 2)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/type_nested_value_tuple_4x3x2.leo b/asg/tests/pass/array/type_nested_value_tuple_4x3x2.leo index 88a5143bd2..9be45de408 100644 --- a/asg/tests/pass/array/type_nested_value_tuple_4x3x2.leo +++ b/asg/tests/pass/array/type_nested_value_tuple_4x3x2.leo @@ -1,10 +1,10 @@ function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], + let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - const b: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; // initializer + let b: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/type_tuple_value_nested_3x2.leo b/asg/tests/pass/array/type_tuple_value_nested_3x2.leo index 81195e03a1..4e061c4309 100644 --- a/asg/tests/pass/array/type_tuple_value_nested_3x2.leo +++ b/asg/tests/pass/array/type_tuple_value_nested_3x2.leo @@ -1,7 +1,7 @@ function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - const b: [u8; (3, 2)] = [[0; 2]; 3]; // initializer + let b: [u8; (3, 2)] = [[0; 2]; 3]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/type_tuple_value_nested_4x3x2.leo b/asg/tests/pass/array/type_tuple_value_nested_4x3x2.leo index 322a6f7601..d9dc698784 100644 --- a/asg/tests/pass/array/type_tuple_value_nested_4x3x2.leo +++ b/asg/tests/pass/array/type_tuple_value_nested_4x3x2.leo @@ -1,10 +1,10 @@ function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], + let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - const b: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; // initializer + let b: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/type_tuple_value_tuple_3x2.leo b/asg/tests/pass/array/type_tuple_value_tuple_3x2.leo index d451a9c1a8..b0693f7667 100644 --- a/asg/tests/pass/array/type_tuple_value_tuple_3x2.leo +++ b/asg/tests/pass/array/type_tuple_value_tuple_3x2.leo @@ -1,7 +1,7 @@ function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - const b: [u8; (3, 2)] = [0; (3, 2)]; // initializer + let b: [u8; (3, 2)] = [0; (3, 2)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/array/type_tuple_value_tuple_4x3x2.leo b/asg/tests/pass/array/type_tuple_value_tuple_4x3x2.leo index 1205b1dc9c..cdc1bc961e 100644 --- a/asg/tests/pass/array/type_tuple_value_tuple_4x3x2.leo +++ b/asg/tests/pass/array/type_tuple_value_tuple_4x3x2.leo @@ -1,10 +1,10 @@ function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], + let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - const b: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; // initializer + let b: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/asg/tests/pass/boolean/all.leo b/asg/tests/pass/boolean/all.leo index 64fe8a795a..29a3815881 100644 --- a/asg/tests/pass/boolean/all.leo +++ b/asg/tests/pass/boolean/all.leo @@ -1,8 +1,8 @@ // !(true && (false || true)) function main() { - const a = true; - const b = false || a; - const c = !(true && b); + let a = true; + let b = false || a; + let c = !(true && b); console.assert(c == false); } \ No newline at end of file diff --git a/asg/tests/pass/group/point.leo b/asg/tests/pass/group/point.leo index 5e68415a0d..85eeb53b7b 100644 --- a/asg/tests/pass/group/point.leo +++ b/asg/tests/pass/group/point.leo @@ -1,3 +1,3 @@ function main() { - const point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group; + let point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group; } \ No newline at end of file diff --git a/asg/tests/pass/import/many_import.leo b/asg/tests/pass/import/many_import.leo index 08ae494c4f..5e85f19778 100644 --- a/asg/tests/pass/import/many_import.leo +++ b/asg/tests/pass/import/many_import.leo @@ -12,15 +12,15 @@ import bar.( // imports directory import import car.Car; // imports directory import function main() { - const point = Point { x: 1u32, y: 1u32 }; - const foo = foo(); + let point = Point { x: 1u32, y: 1u32 }; + let foo = foo(); - const bar = Bar { r: 1u32 }; - const baz = Baz { z: 1u32 }; - const bazzar = Bazzar { a: 1u32 }; - const bat = Bat { t: 1u32 }; + let bar = Bar { r: 1u32 }; + let baz = Baz { z: 1u32 }; + let bazzar = Bazzar { a: 1u32 }; + let bat = Bat { t: 1u32 }; - const car = Car { c: 1u32 }; + let car = Car { c: 1u32 }; console.assert(car.c == 1u32); } \ No newline at end of file diff --git a/asg/tests/pass/import/many_import_star.leo b/asg/tests/pass/import/many_import_star.leo index 575487a929..5145d0d05d 100644 --- a/asg/tests/pass/import/many_import_star.leo +++ b/asg/tests/pass/import/many_import_star.leo @@ -6,14 +6,14 @@ import bar.bat.bat.*; // imports directory import import car.*; // imports directory import function main() { - const point = Point { x: 1u32, y: 1u32 }; - const foo = foo(); + let point = Point { x: 1u32, y: 1u32 }; + let foo = foo(); - const bar = Bar { r: 1u32 }; - const bat = Bat { t: 1u32 }; - const baz = Baz { z: 1u32 }; + let bar = Bar { r: 1u32 }; + let bat = Bat { t: 1u32 }; + let baz = Baz { z: 1u32 }; - const car = Car { c: 1u32 }; + let car = Car { c: 1u32 }; console.assert(car.c == 1u32); } \ No newline at end of file diff --git a/asg/tests/pass/statements/ternary_basic.leo b/asg/tests/pass/statements/ternary_basic.leo index 5106363ce2..1f9c1f65a2 100644 --- a/asg/tests/pass/statements/ternary_basic.leo +++ b/asg/tests/pass/statements/ternary_basic.leo @@ -1,5 +1,5 @@ function main(a: bool, b: bool) { let c = if a ? true : false; - const d = c == b; + let d = c == b; } \ No newline at end of file diff --git a/ast/src/errors/deprecated.rs b/ast/src/errors/deprecated.rs index a7ae558421..c22419d3ee 100644 --- a/ast/src/errors/deprecated.rs +++ b/ast/src/errors/deprecated.rs @@ -61,3 +61,10 @@ impl<'ast> TryFrom> for DeprecatedError { } } } + +impl DeprecatedError { + pub fn const_statement(span: &Span) -> Self { + let message = "const _ = ... is deprecated. Did you mean let?".to_string(); + Self::new_from_span(message, span.clone()) + } +} diff --git a/compiler/tests/array/multi_initializer.leo b/compiler/tests/array/multi_initializer.leo index 6133542ef0..7257999ddf 100644 --- a/compiler/tests/array/multi_initializer.leo +++ b/compiler/tests/array/multi_initializer.leo @@ -1,7 +1,7 @@ function main() { - const a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)]; + let a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)]; - const b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2]; + let b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2]; console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/nested_3x2_value.leo b/compiler/tests/array/nested_3x2_value.leo index c5f64c997e..b69ddffb89 100644 --- a/compiler/tests/array/nested_3x2_value.leo +++ b/compiler/tests/array/nested_3x2_value.leo @@ -1,8 +1,8 @@ // Multidimensional array syntax in leo function main() { - const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline + let a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline - const b: [u32; (3, 2)] = [[0; 2]; 3]; // initializer + let b: [u32; (3, 2)] = [[0; 2]; 3]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/nested_3x2_value_fail.leo b/compiler/tests/array/nested_3x2_value_fail.leo index a187a51991..35c8478cd1 100644 --- a/compiler/tests/array/nested_3x2_value_fail.leo +++ b/compiler/tests/array/nested_3x2_value_fail.leo @@ -1,4 +1,4 @@ // Multidimensional array syntax in leo function main() { - const a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) + let a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) } diff --git a/compiler/tests/array/tuple_3x2_value.leo b/compiler/tests/array/tuple_3x2_value.leo index b6659539d5..dc9128c51e 100644 --- a/compiler/tests/array/tuple_3x2_value.leo +++ b/compiler/tests/array/tuple_3x2_value.leo @@ -1,8 +1,8 @@ // Multidimensional array syntax in leo function main() { - const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline + let a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline - const b: [u32; (3, 2)] = [0; (3, 2)]; // initializer + let b: [u32; (3, 2)] = [0; (3, 2)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/tuple_3x2_value_fail.leo b/compiler/tests/array/tuple_3x2_value_fail.leo index 78593ab696..42e6f61500 100644 --- a/compiler/tests/array/tuple_3x2_value_fail.leo +++ b/compiler/tests/array/tuple_3x2_value_fail.leo @@ -1,4 +1,4 @@ // Multidimensional array syntax in leo function main() { - const a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) + let a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) } diff --git a/compiler/tests/array/type_input_3x2.leo b/compiler/tests/array/type_input_3x2.leo index ea60a0cc24..40781415c1 100644 --- a/compiler/tests/array/type_input_3x2.leo +++ b/compiler/tests/array/type_input_3x2.leo @@ -1,5 +1,5 @@ function main(a: [[u8; 2]; 3]) { - const b = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let b = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/type_input_4x3x2.leo b/compiler/tests/array/type_input_4x3x2.leo index 2d9c4cff22..bd75514904 100644 --- a/compiler/tests/array/type_input_4x3x2.leo +++ b/compiler/tests/array/type_input_4x3x2.leo @@ -1,5 +1,5 @@ function main(a: [[[u8; 2]; 3]; 4]) { - const b = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], + let b = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline diff --git a/compiler/tests/array/type_nested_value_nested_3x2.leo b/compiler/tests/array/type_nested_value_nested_3x2.leo index bcf5bae674..341b9ead9c 100644 --- a/compiler/tests/array/type_nested_value_nested_3x2.leo +++ b/compiler/tests/array/type_nested_value_nested_3x2.leo @@ -1,7 +1,7 @@ function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - const b: [[u8; 2]; 3] = [[0; 2]; 3]; // initializer + let b: [[u8; 2]; 3] = [[0; 2]; 3]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/type_nested_value_nested_3x2_fail.leo b/compiler/tests/array/type_nested_value_nested_3x2_fail.leo index 56c8916fb0..4bd07f85db 100644 --- a/compiler/tests/array/type_nested_value_nested_3x2_fail.leo +++ b/compiler/tests/array/type_nested_value_nested_3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) + let b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/compiler/tests/array/type_nested_value_nested_4x3x2.leo b/compiler/tests/array/type_nested_value_nested_4x3x2.leo index 1691fa26c7..5ba24a381b 100644 --- a/compiler/tests/array/type_nested_value_nested_4x3x2.leo +++ b/compiler/tests/array/type_nested_value_nested_4x3x2.leo @@ -1,10 +1,10 @@ function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], + let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - const b: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; // initializer + let b: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/type_nested_value_nested_4x3x2_fail.leo b/compiler/tests/array/type_nested_value_nested_4x3x2_fail.leo index 480327a91d..6479004d68 100644 --- a/compiler/tests/array/type_nested_value_nested_4x3x2_fail.leo +++ b/compiler/tests/array/type_nested_value_nested_4x3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) + let b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/compiler/tests/array/type_nested_value_tuple_3x2.leo b/compiler/tests/array/type_nested_value_tuple_3x2.leo index 5f14084d55..c6fac9ec64 100644 --- a/compiler/tests/array/type_nested_value_tuple_3x2.leo +++ b/compiler/tests/array/type_nested_value_tuple_3x2.leo @@ -1,7 +1,7 @@ function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - const b: [[u8; 2]; 3] = [0; (3, 2)]; // initializer + let b: [[u8; 2]; 3] = [0; (3, 2)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/type_nested_value_tuple_3x2_fail.leo b/compiler/tests/array/type_nested_value_tuple_3x2_fail.leo index 3bfb559615..ba99b070c7 100644 --- a/compiler/tests/array/type_nested_value_tuple_3x2_fail.leo +++ b/compiler/tests/array/type_nested_value_tuple_3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) + let b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/compiler/tests/array/type_nested_value_tuple_4x3x2.leo b/compiler/tests/array/type_nested_value_tuple_4x3x2.leo index 88a5143bd2..9be45de408 100644 --- a/compiler/tests/array/type_nested_value_tuple_4x3x2.leo +++ b/compiler/tests/array/type_nested_value_tuple_4x3x2.leo @@ -1,10 +1,10 @@ function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], + let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - const b: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; // initializer + let b: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/type_nested_value_tuple_4x3x2_fail.leo b/compiler/tests/array/type_nested_value_tuple_4x3x2_fail.leo index ce1219a37b..95172bf329 100644 --- a/compiler/tests/array/type_nested_value_tuple_4x3x2_fail.leo +++ b/compiler/tests/array/type_nested_value_tuple_4x3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering) + let b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/compiler/tests/array/type_tuple_value_nested_3x2.leo b/compiler/tests/array/type_tuple_value_nested_3x2.leo index 81195e03a1..4e061c4309 100644 --- a/compiler/tests/array/type_tuple_value_nested_3x2.leo +++ b/compiler/tests/array/type_tuple_value_nested_3x2.leo @@ -1,7 +1,7 @@ function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - const b: [u8; (3, 2)] = [[0; 2]; 3]; // initializer + let b: [u8; (3, 2)] = [[0; 2]; 3]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/type_tuple_value_nested_3x2_fail.leo b/compiler/tests/array/type_tuple_value_nested_3x2_fail.leo index e84f025a9f..9732cf26ef 100644 --- a/compiler/tests/array/type_tuple_value_nested_3x2_fail.leo +++ b/compiler/tests/array/type_tuple_value_nested_3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering) + let b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/compiler/tests/array/type_tuple_value_nested_4x3x2.leo b/compiler/tests/array/type_tuple_value_nested_4x3x2.leo index 322a6f7601..d9dc698784 100644 --- a/compiler/tests/array/type_tuple_value_nested_4x3x2.leo +++ b/compiler/tests/array/type_tuple_value_nested_4x3x2.leo @@ -1,10 +1,10 @@ function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], + let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - const b: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; // initializer + let b: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/type_tuple_value_nested_4x3x2_fail.leo b/compiler/tests/array/type_tuple_value_nested_4x3x2_fail.leo index cbb7ccbf76..b820c4d088 100644 --- a/compiler/tests/array/type_tuple_value_nested_4x3x2_fail.leo +++ b/compiler/tests/array/type_tuple_value_nested_4x3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) + let b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/compiler/tests/array/type_tuple_value_tuple_3x2.leo b/compiler/tests/array/type_tuple_value_tuple_3x2.leo index d451a9c1a8..b0693f7667 100644 --- a/compiler/tests/array/type_tuple_value_tuple_3x2.leo +++ b/compiler/tests/array/type_tuple_value_tuple_3x2.leo @@ -1,7 +1,7 @@ function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline + let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - const b: [u8; (3, 2)] = [0; (3, 2)]; // initializer + let b: [u8; (3, 2)] = [0; (3, 2)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/type_tuple_value_tuple_3x2_fail.leo b/compiler/tests/array/type_tuple_value_tuple_3x2_fail.leo index 884a75db9d..99487ccb7a 100644 --- a/compiler/tests/array/type_tuple_value_tuple_3x2_fail.leo +++ b/compiler/tests/array/type_tuple_value_tuple_3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering) + let b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering) } \ No newline at end of file diff --git a/compiler/tests/array/type_tuple_value_tuple_4x3x2.leo b/compiler/tests/array/type_tuple_value_tuple_4x3x2.leo index 1205b1dc9c..cdc1bc961e 100644 --- a/compiler/tests/array/type_tuple_value_tuple_4x3x2.leo +++ b/compiler/tests/array/type_tuple_value_tuple_4x3x2.leo @@ -1,10 +1,10 @@ function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], + let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - const b: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; // initializer + let b: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; // initializer console.assert(a == b); } \ No newline at end of file diff --git a/compiler/tests/array/type_tuple_value_tuple_4x3x2_fail.leo b/compiler/tests/array/type_tuple_value_tuple_4x3x2_fail.leo index 31e2a5e552..824fd90bc6 100644 --- a/compiler/tests/array/type_tuple_value_tuple_4x3x2_fail.leo +++ b/compiler/tests/array/type_tuple_value_tuple_4x3x2_fail.leo @@ -1,3 +1,3 @@ function main() { - const b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order) + let b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order) } \ No newline at end of file diff --git a/compiler/tests/boolean/all.leo b/compiler/tests/boolean/all.leo index 64fe8a795a..29a3815881 100644 --- a/compiler/tests/boolean/all.leo +++ b/compiler/tests/boolean/all.leo @@ -1,8 +1,8 @@ // !(true && (false || true)) function main() { - const a = true; - const b = false || a; - const c = !(true && b); + let a = true; + let b = false || a; + let c = !(true && b); console.assert(c == false); } \ No newline at end of file diff --git a/compiler/tests/circuits/duplicate_name_context.leo b/compiler/tests/circuits/duplicate_name_context.leo index 4fe20a12e8..98ff42d8f0 100644 --- a/compiler/tests/circuits/duplicate_name_context.leo +++ b/compiler/tests/circuits/duplicate_name_context.leo @@ -8,6 +8,6 @@ circuit Bar { function main () { let Bar = 66u32; - const k1 = Bar{ b2: 30u32 }; - const k2 = Bar::add_five(55u32); + let k1 = Bar{ b2: 30u32 }; + let k2 = Bar::add_five(55u32); } \ No newline at end of file diff --git a/compiler/tests/function/scope_fail.leo b/compiler/tests/function/scope_fail.leo index ac6bfcad37..773c2479d7 100644 --- a/compiler/tests/function/scope_fail.leo +++ b/compiler/tests/function/scope_fail.leo @@ -3,6 +3,6 @@ function foo() -> field { } function main() { - const myGlobal = 42field; + let myGlobal = 42field; let err = foo(); } \ No newline at end of file diff --git a/compiler/tests/group/point.leo b/compiler/tests/group/point.leo index 5e68415a0d..85eeb53b7b 100644 --- a/compiler/tests/group/point.leo +++ b/compiler/tests/group/point.leo @@ -1,3 +1,3 @@ function main() { - const point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group; + let point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group; } \ No newline at end of file diff --git a/compiler/tests/import/many_import.leo b/compiler/tests/import/many_import.leo index 08ae494c4f..5e85f19778 100644 --- a/compiler/tests/import/many_import.leo +++ b/compiler/tests/import/many_import.leo @@ -12,15 +12,15 @@ import bar.( // imports directory import import car.Car; // imports directory import function main() { - const point = Point { x: 1u32, y: 1u32 }; - const foo = foo(); + let point = Point { x: 1u32, y: 1u32 }; + let foo = foo(); - const bar = Bar { r: 1u32 }; - const baz = Baz { z: 1u32 }; - const bazzar = Bazzar { a: 1u32 }; - const bat = Bat { t: 1u32 }; + let bar = Bar { r: 1u32 }; + let baz = Baz { z: 1u32 }; + let bazzar = Bazzar { a: 1u32 }; + let bat = Bat { t: 1u32 }; - const car = Car { c: 1u32 }; + let car = Car { c: 1u32 }; console.assert(car.c == 1u32); } \ No newline at end of file diff --git a/compiler/tests/import/many_import_star.leo b/compiler/tests/import/many_import_star.leo index 575487a929..5145d0d05d 100644 --- a/compiler/tests/import/many_import_star.leo +++ b/compiler/tests/import/many_import_star.leo @@ -6,14 +6,14 @@ import bar.bat.bat.*; // imports directory import import car.*; // imports directory import function main() { - const point = Point { x: 1u32, y: 1u32 }; - const foo = foo(); + let point = Point { x: 1u32, y: 1u32 }; + let foo = foo(); - const bar = Bar { r: 1u32 }; - const bat = Bat { t: 1u32 }; - const baz = Baz { z: 1u32 }; + let bar = Bar { r: 1u32 }; + let bat = Bat { t: 1u32 }; + let baz = Baz { z: 1u32 }; - const car = Car { c: 1u32 }; + let car = Car { c: 1u32 }; console.assert(car.c == 1u32); } \ No newline at end of file diff --git a/compiler/tests/mutability/const.leo b/compiler/tests/mutability/const.leo index 44f9279085..d2a3a6ac2b 100644 --- a/compiler/tests/mutability/const.leo +++ b/compiler/tests/mutability/const.leo @@ -1,5 +1,5 @@ -// Constant variables are immutable by default. +// Let variables are immutable by default. function main() { - const a = 1u32; + let a = 1u32; a = 0; } \ No newline at end of file diff --git a/compiler/tests/mutability/const_mut.leo b/compiler/tests/mutability/const_mut.leo deleted file mode 100644 index ef194ae178..0000000000 --- a/compiler/tests/mutability/const_mut.leo +++ /dev/null @@ -1,4 +0,0 @@ -// Adding the `mut` keyword to a constant variable is illegal -function main() { - const mut a = 1u32; -} \ No newline at end of file diff --git a/compiler/tests/mutability/mod.rs b/compiler/tests/mutability/mod.rs index 6c1555c870..ded55960bb 100644 --- a/compiler/tests/mutability/mod.rs +++ b/compiler/tests/mutability/mod.rs @@ -49,14 +49,6 @@ fn test_const_fail() { expect_asg_error(error); } -#[test] -fn test_const_mut_fail() { - let program_string = include_str!("const_mut.leo"); - let error = parse_program(program_string).err().unwrap(); - - expect_asg_error(error); -} - #[test] fn test_array() { let program_string = include_str!("array.leo"); diff --git a/compiler/tests/statements/ternary_basic.leo b/compiler/tests/statements/ternary_basic.leo index 5106363ce2..1f9c1f65a2 100644 --- a/compiler/tests/statements/ternary_basic.leo +++ b/compiler/tests/statements/ternary_basic.leo @@ -1,5 +1,5 @@ function main(a: bool, b: bool) { let c = if a ? true : false; - const d = c == b; + let d = c == b; } \ No newline at end of file diff --git a/examples/pedersen-hash/src/main.leo b/examples/pedersen-hash/src/main.leo index 225a05ad19..25050216da 100644 --- a/examples/pedersen-hash/src/main.leo +++ b/examples/pedersen-hash/src/main.leo @@ -19,8 +19,8 @@ circuit PedersenHash { // The 'pedersen-hash' main function. function main() -> group { - const parameters = [1group; 256]; - const pedersen = PedersenHash::new(parameters); + let parameters = [1group; 256]; + let pedersen = PedersenHash::new(parameters); let hash_input: [bool; 256] = [true; 256]; return pedersen.hash(hash_input) } diff --git a/grammar/benches/main.leo b/grammar/benches/main.leo index a769e0fdff..aafe79bcce 100644 --- a/grammar/benches/main.leo +++ b/grammar/benches/main.leo @@ -19,8 +19,8 @@ circuit PedersenHash { // The 'pedersen-hash' main function. function main() -> group { - const parameters = [1group; 256]; - const pedersen = PedersenHash::new(parameters); + let parameters = [1group; 256]; + let pedersen = PedersenHash::new(parameters); let hash_input: [bool; 256] = [true; 256]; return pedersen.hash(hash_input) }