Lyricdev
GitHub

LYR-SEM0010

a binding whose type nothing fixes

error ยท spec 07-statements

A local, global or static binding has neither a declared type nor an initializer, or its only initializer is null or [], which fix no type on their own. A static member of an interface without a type is reported here too.

Explanation

A binding's type is written or inferred from its initializer. null and an empty array [] belong to many types, so they leave the binding without one.

Write the type: let x: ?string = null;, var xs: int[] = [];.

Wrong

fn main(): void {
    let x = null;
    let _ = x;
}
fn main(): void {
    let x: ?int = null;
    let _ = x;
}