Lyricdev
GitHub

LYR-SEM0053

an attribute used as an expression

error ยท spec 11-metaprogramming

An @Name stands where an expression is expected. Attributes describe the declaration they precede and have no value.

Explanation

An attribute such as @NonExhaustive is written before a declaration and is read by the compiler or by macros; it is not a value and cannot be computed with.

Move the attribute before the declaration it belongs to, or remove it from the expression.

Wrong

fn main(): void {
    let _ = @Test;
}
fn main(): void {
    let _ = 0;
}