Skip to content

Integer literals above i64::MAX crash the compiler #165

Closed

Description

@Kinflou

Any integer literal larger than i64::MAX panics the compiler, including a valid u64 constant:

const X: u64 = 18446744073709551615
thread 'main' panicked at core/src/schema/idl/grammar.rs:1063:75:
called `Result::unwrap()` on an `Err` value: ParseIntError { kind: PosOverflow }

IntegerLiteral parses -?\d+ into an i64 with s.parse().unwrap(). The same panic happens for a fixed array size (u8[99999999999999999999]) or any other literal.

Fix: parse into a type wide enough for every integer type (i128, or keep the digits as text), and report a literal no type can hold as a diagnostic, not a panic. u64::MAX must stay writable.

Also in the language server and the playground. Both run this parser on what's typed. In the playground (core 5259393, built to wasm), such a literal makes compile, generate (Rust and TypeScript), the simulator's describe_project, hover and completion all fail with RuntimeError: unreachable and a "wasm error" status, until the literal is edited away; only highlighting keeps working. The module recovers afterwards. Typing a u64 constant near its maximum is enough to hit it.

Found on core master (a8aee68).

Activity

  1. added
    bugSomething isn't working
    P1Next
    on Nov 2, 2026
  2. Kinflou commented on Nov 9, 2026

    @Kinflou
    MemberAuthor

    Fixed by fd780b4: a literal above i64::MAX is now a parse::integer-out-of-range diagnostic at the literal, not a panic. Since #215, the ids_parse fuzz target checks this nightly.

  3. moved this from Todo to Done in Comline Development Roadmapon Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1NextbugSomething isn't workingcompilerParser, IR, CAS

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions