add test for const self, no clippy issues locally

This commit is contained in:
gluax 2021-03-25 14:30:06 -04:00
parent 128eb60dfb
commit 793cbb9f27
3 changed files with 22 additions and 4 deletions

View File

@ -0,0 +1,13 @@
circuit Foo {
a: u8,
function set_a(const self, new: u8) {
self.a = new;
}
}
function main() {
let f = Foo { a: 0u8 };
f.set_a(1u8);
}

View File

@ -132,6 +132,15 @@ fn test_member_static_function_undefined() {
expect_asg_error(error) expect_asg_error(error)
} }
// Constant
#[test]
fn test_const_self_variable_fail() {
let program_string = include_str!("const_self_variable_fail.leo");
let error = parse_program(program_string).err().unwrap();
expect_asg_error(error);
}
// Mutability // Mutability
#[test] #[test]

View File

@ -19,11 +19,7 @@ circuit PedersenHash {
// The 'pedersen-hash' main function. // The 'pedersen-hash' main function.
function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group { function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group {
<<<<<<< HEAD
const pedersen = PedersenHash::new(parameters); const pedersen = PedersenHash::new(parameters);
=======
let pedersen = PedersenHash::new(parameters);
>>>>>>> 9b61d0fa152f435e3e165090455c85eedeb9b770
return pedersen.hash(hash_input) return pedersen.hash(hash_input)
} }