mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-09-11 05:45:30 +03:00
fix multiple assignment bug
This commit is contained in:
parent
1dcaa06ef0
commit
48ab4747e0
@ -1,11 +1,9 @@
|
||||
function main(a: private bool) -> (u32) {
|
||||
b = 0;
|
||||
for i in 0..4 {
|
||||
if (a) {
|
||||
return 9
|
||||
} else {
|
||||
b = b + i;
|
||||
}
|
||||
}
|
||||
return b
|
||||
function test() -> (u32, u32[2]) {
|
||||
return 1, [2, 3]
|
||||
}
|
||||
|
||||
function main() -> (u32[3]) {
|
||||
a, b = test();
|
||||
// a, u32[2] b = test() <- explicit type also works
|
||||
return [a, ...b]
|
||||
}
|
@ -303,12 +303,10 @@ impl<F: Field + PrimeField, CS: ConstraintSystem<F>> ResolvedProgram<F, CS> {
|
||||
// this function call is inline so we unwrap the return value
|
||||
match self.enforce_function(cs, file_scope, function, arguments) {
|
||||
ResolvedValue::Return(return_values) => {
|
||||
if return_values.len() == 0 {
|
||||
ResolvedValue::Return(vec![])
|
||||
} else if return_values.len() == 1 {
|
||||
if return_values.len() == 1 {
|
||||
return_values[0].clone()
|
||||
} else {
|
||||
unimplemented!("function {} returns multiple values but is used in an expression that expects one", function_name)
|
||||
ResolvedValue::Return(return_values)
|
||||
}
|
||||
}
|
||||
value => unimplemented!(
|
||||
|
Loading…
Reference in New Issue
Block a user