Sakura Lang

V0003 int_literal_out_of_range

An Int literal is outside the 64-bit signed range [-2^63, 2^63-1] (design §2.2).

An error from the lex phase. sakura explain V0003 prints this explanation offline.

An Int literal is outside the 64-bit signed range [-2^63, 2^63-1] (design §2.2).

Use a smaller value, or Decimal/Float if you need the magnitude.

Wrong program

compiler/tests/ui/V0003_int_literal_out_of_range.sakura, which the compiler's ui suite runs through sakura check:

fn big() -> Int { 9_223_372_036_854_775_808 }

sakura check --json reports this record (pretty-printed; $DIR is the fixture's directory):

{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:37998ae869d3227c",
  "code": "V0003",
  "severity": "error",
  "phase": "lex",
  "message": "integer literal does not fit in a signed 64-bit `Int`",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": "main::V0003_int_literal_out_of_range::big",
  "spans": [
    {
      "uri": "file://$DIR/V0003_int_literal_out_of_range.sakura",
      "content_hash": "sha256:5f34d3ad63174507c3a9b1b8d90384b2936de88d9f320c4e0fda01794042702f",
      "start_byte": 52,
      "end_byte": 77,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V0003",
  "fixes": []
}

Fixed program

compiler/tests/ui/V0003_int_literal_out_of_range.fixed.sakura, which sakura check accepts with no diagnostics:

fn big() -> Int { 9_223_372_036_854_775_807 }
Edit on GitHub

On this page