Lyricdev
GitHub

LYR-SEM0227

an integer literal too large for 'int'

error · spec 01-lexical

An integer literal without a suffix whose type is int is greater than int.max.

Explanation

A literal takes its type from where it stands, int where nothing else is asked; one beyond int.max (9223372036854775807) does not fit, and a literal never wraps.

Give it a type that holds it — an annotation uint, or the suffix u — or write a smaller number.

Wrong

fn main(): void {
    let big = 9223372036854775808;
    let _ = big;
}
fn main(): void {
    let big: uint = 9223372036854775808;
    let _ = big;
}