Lyricdev
GitHub

LYR-PAR0063

'quote' without a block

error ยท spec 11-metaprogramming

The word quote is not followed by {.

Explanation

A quote is code written as a value, in braces: quote { a + b }, quote { fn f(): void { } }. Without the braces it holds nothing.

Write the quoted code in braces.

Wrong

//- src/main.lyr
import app.macros { one };

fn main(): void {
    let _ = one!();
}
//- src/macros.lyr
import std.syntax { Expr };

pub macro one(): Expr {
    return quote;
}
//- src/main.lyr
import app.macros { one };

fn main(): void {
    let _ = one!();
}
//- src/macros.lyr
import std.syntax { Expr };

pub macro one(): Expr {
    return quote { 1 };
}