You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix parser panic for radix literals in default parameters #475
bugA problem that causes incorrect behavior or crashes.good first issueIssues that are good for newcomers or first-time contributors.needs testingIssues that require additional testing or verification.
The frontend panics while parsing a non-decimal integer literal used as a default parameter value.
fun value(number: i32 = 0x10) -> i32 { return number; }
fun main() -> i32 { return value(); }
On current master plus PR #474, wavec check exits with status 101:
front/parser/src/parser/functions.rs:154:52
called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
parse_default_value currently feeds the token spelling to decimal-only str::parse().unwrap(). User source must never reach a parser panic, and default values should follow the same literal contract as ordinary expressions and constants.
This is an alpha release blocker found during the audit following #474.
Scope
Remove the integer and float unwrap paths from default-value parsing.
Reuse the frontend's canonical numeric-literal parser instead of creating a second grammar.
Accept every numeric literal spelling that is valid in an ordinary constant expression.
Return a structured source diagnostic for malformed or out-of-range defaults.
Add decimal, binary, hexadecimal, malformed, and overflow regression cases.
Acceptance criteria
The reproducer checks successfully and evaluates the default as 16.
Malformed default literals produce a nonzero compiler result without a Rust panic.
Numeric default parameters and ordinary numeric expressions use one documented grammar.
bugA problem that causes incorrect behavior or crashes.good first issueIssues that are good for newcomers or first-time contributors.needs testingIssues that require additional testing or verification.
Activity