Lyricdev
GitHub

LYR-LEX0016

a float literal without digits on one side of its point

error ยท spec 01-lexical

A float literal is written 1. or .5. Each is refused once and read as the float it means.

Explanation

A float literal has digits on both sides of its .: 1.0, 0.5. 1. reads like the start of a member access, .5 like an implicit member; the full form leaves no doubt.

Write the missing 0.

Wrong

fn main(): void {
    let a = 1.;
    let _ = a;
}
fn main(): void {
    let a = 1.0;
    let _ = a;
}