Lyricdev
GitHub

LYR-PAR0054

'&' outside an argument

error · spec 08-expressions

The mark & stands before an operand that is not an argument of a call — in a binding, an operation, a returned value.

Explanation

&x passes the place x to a parameter that takes a place, fn bump(&n: int). There is no address as a value in Lyric, so the mark stands at an argument and nowhere else.

Remove the &, or pass the place to a function that takes one.

Wrong

fn main(): void {
    var x = 1;
    let y = &x;
}
fn bump(&n: int): void {
    n += 1;
}

fn main(): void {
    var x = 1;
    bump(&x);
    let _ = x;
}