LYR-SEM0157
an argument's place mark does not fit its parameter
A place parameter's argument is written without &, a value parameter's argument with &, or a lambda's parameter mark &n does not match the function type expected where the lambda stands.
Explanation
A call shows what it may write: an argument for a place parameter &n is written &x, and only such an argument is. The mark is part of the call's text so that a reader sees, at the call, which of the caller's variables change. A lambda marks its parameter &n exactly where the function type it stands for hands a place over.
Add & before the argument of a place parameter, remove it before the argument of a value parameter, and match a lambda's marks to its expected type.
Wrong
fn increment(&n: int): void {
n += 1;
}
fn main(): void {
var x = 1;
increment(x);
}
Right
fn increment(&n: int): void {
n += 1;
}
fn main(): void {
var x = 1;
increment(&x);
}