Home / Docs / Diagnostics
U0007: Malformed literal
Release v0.4.0
U0007 reports:
- an integer literal with a leading zero, a doubled underscore, or an underscore at its start or end,
- an unescaped
}in text, - an unescaped
{that no expression can follow, a quote, a backslash or a}, as in JSON written in text ("{\"id\": 7}"is"\{\"id\": 7\}").
Why Una rejects it
- An integer literal is written in decimal digits, with
_allowed only between two digits to group them, and without leading zeros except for0itself (spec/01 §6). - Inside a text literal,
{starts an interpolation and}ends it, so a}outside an interpolation must be escaped as\}.
How to fix it
When the intended spelling is unambiguous, the diagnostic carries a mechanical edit.
The repair at a glance
diff
module demo
- pub timeout() -> Int = 030
+ pub timeout() -> Int = 30Failing example
una
module demo
pub timeout() -> Int = 030Fixed example
una
module demo
pub timeout() -> Int = 30