Lyricdev
GitHub

LYR-SEM0051

a function without a body

error ยท spec 13-abi

A function declaration outside the standard library has no body and is not an extern declaration.

Explanation

Only the standard library declares functions whose body the compiler or the runtime provides. A program's bodyless function is either a function to be written, or a foreign one, which is declared extern with its ABI.

Write the body, or declare the function extern.

Wrong

fn twice(n: int): int;

fn main(): void {
    let _ = twice(2);
}
fn twice(n: int): int { return n * 2; }

fn main(): void {
    let _ = twice(2);
}