mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-23 23:23:50 +03:00
Merge pull request #869 from AleoHQ/bug/calling-mut-method-from-immutable-context
bug-fix-852
This commit is contained in:
commit
5f46ccc026
@ -71,7 +71,7 @@ impl<'a> ExpressionNode<'a> for CallExpression<'a> {
|
||||
}
|
||||
|
||||
fn is_mut_ref(&self) -> bool {
|
||||
false
|
||||
true
|
||||
}
|
||||
|
||||
fn const_value(&self) -> Option<ConstValue> {
|
||||
|
@ -5,8 +5,21 @@ circuit TestMe {
|
||||
self.x += 1;
|
||||
return self.x;
|
||||
}
|
||||
|
||||
function new() -> Self {
|
||||
return Self { x: 1u8 };
|
||||
}
|
||||
}
|
||||
|
||||
function my_fn() -> TestMe {
|
||||
return TestMe { x: 0u8 };
|
||||
}
|
||||
|
||||
function main () {
|
||||
const t = TestMe {x: 6u8}.test_me();
|
||||
console.assert(t == 7u8);
|
||||
const u = my_fn().test_me();
|
||||
console.assert(u == 1u8);
|
||||
const v = TestMe::new().test_me();
|
||||
console.assert(v == 2u8);
|
||||
}
|
Loading…
Reference in New Issue
Block a user