V0006 malformed_number
A numeric literal is malformed, such as 0x with no digits, 1. or .5.
An error from the lex phase. sakura explain V0006 prints this explanation offline.
A numeric literal is malformed, such as 0x with no digits, 1. or .5. Write 1.0 and
0.5.
Wrong program
compiler/tests/ui/V0006_malformed_number.sakura, which the compiler's ui suite runs through sakura check:
fn mask() -> Int { 0x }sakura check --json reports this record (pretty-printed; $DIR is the fixture's directory):
{
"schema_version": "1.0",
"kind": "diagnostic",
"id": "d:1f18f202097b2ae9",
"code": "V0006",
"severity": "error",
"phase": "lex",
"message": "expected digits after the radix prefix",
"snapshot": "sha256:$SNAPSHOT",
"symbol_id": "main::V0006_malformed_number::mask",
"spans": [
{
"uri": "file://$DIR/V0006_malformed_number.sakura",
"content_hash": "sha256:edf2b37f01fbd7978f1ea473f4aebd0b929ec45ffb55cbb3ccb801ffbde17eb2",
"start_byte": 53,
"end_byte": 55,
"role": "primary"
}
],
"related_ids": [],
"expected": null,
"actual": null,
"obligation": null,
"counterexample": null,
"explanation_uri": "sakura://explain/V0006",
"fixes": []
}Fixed program
compiler/tests/ui/V0006_malformed_number.fixed.sakura, which sakura check accepts with no diagnostics:
fn mask() -> Int { 0xff }