mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 10:41:57 +03:00
fix cargo lock
This commit is contained in:
commit
8ace306e2c
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -1824,12 +1824,12 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.30"
|
||||
version = "0.10.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d575eff3665419f9b83678ff2815858ad9d11567e082f5ac1814baba4e2bcb4"
|
||||
checksum = "8d008f51b1acffa0d3450a68606e6a51c123012edaacb0f4e1426bd978869187"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if 0.1.10",
|
||||
"cfg-if 1.0.0",
|
||||
"foreign-types",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
@ -3119,9 +3119,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.10"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c"
|
||||
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
|
@ -34,7 +34,13 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
// Check that assignee exists and is mutable
|
||||
Ok(match self.get_mut(name) {
|
||||
Some(value) => match value {
|
||||
ConstrainedValue::Mutable(mutable_value) => mutable_value,
|
||||
ConstrainedValue::Mutable(mutable_value) => {
|
||||
// Get the mutable value.
|
||||
mutable_value.get_inner_mut();
|
||||
|
||||
// Return the mutable value.
|
||||
mutable_value
|
||||
}
|
||||
_ => return Err(StatementError::immutable_assign(name.to_owned(), span.to_owned())),
|
||||
},
|
||||
None => return Err(StatementError::undefined_variable(name.to_owned(), span.to_owned())),
|
||||
|
@ -136,3 +136,11 @@ fn test_function_input_mut() {
|
||||
|
||||
assert_satisfied(program);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_swap() {
|
||||
let program_string = include_str!("swap.leo");
|
||||
let program = parse_program(program_string).unwrap();
|
||||
|
||||
assert_satisfied(program);
|
||||
}
|
||||
|
20
compiler/tests/mutability/swap.leo
Normal file
20
compiler/tests/mutability/swap.leo
Normal file
@ -0,0 +1,20 @@
|
||||
// Swap two elements of an array.
|
||||
function swap(mut a: [u32; 2], i: u32, j: u32) -> [u32; 2] {
|
||||
let t = a[i];
|
||||
a[i] = a[j];
|
||||
a[j] = t;
|
||||
return a
|
||||
}
|
||||
|
||||
function main() {
|
||||
let mut arr: [u32; 2] = [0, 1];
|
||||
let expected: [u32; 2] = [1, 0];
|
||||
|
||||
// Do swap.
|
||||
let actual = swap(arr, 0, 1);
|
||||
|
||||
// Check result.
|
||||
for i in 0..2 {
|
||||
console.assert(expected[i] == actual[i]);
|
||||
}
|
||||
}
|
@ -444,8 +444,8 @@ input_tuple = _{ "(" ~ NEWLINE* ~ (input ~ ("," ~ NEWLINE* ~ input)* ~ ","?)? ~
|
||||
// Declared in imports/import.rs
|
||||
import = { "import " ~ package ~ LINE_END}
|
||||
|
||||
|
||||
package_name = @{ ((ASCII_ALPHA_LOWER | ASCII_DIGIT) ~ ( "-" ~ (ASCII_ALPHA_LOWER | ASCII_DIGIT))*)+ }
|
||||
// Declared in imports/package_name.rs
|
||||
package_name = @{ (ASCII_ALPHA_LOWER | ASCII_DIGIT)+ ~ ( "-" ~ (ASCII_ALPHA_LOWER | ASCII_DIGIT)+)* }
|
||||
|
||||
// Declared in imports/package.rs
|
||||
package = { package_name ~ "." ~ package_access }
|
||||
|
Loading…
Reference in New Issue
Block a user