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
Reject unexpected tokens instead of skipping them in function bodies #476
bugA problem that causes incorrect behavior or crashes.criticalAn urgent issue requiring immediate resolution.needs testingIssues that require additional testing or verification.refactorIssues that require code refactoring without changing functionality.
The outer function-body parser can silently discard tokens that do not start one of its hand-written statement branches. This allows malformed source to pass wavec check with status 0.
fun main() -> i32 {
1 ? 2;
return 0;
}
fun ping() { }
fun main() {
ping() ping();
}
Both examples succeed on current master plus PR #474. In front/parser/src/parser/functions.rs, the outer-body fallback attempts an expression and then advances past the current token when parsing fails. This differs from nested-block statement parsing and can turn unsupported syntax, missing separators, or typos into a different program.
Silently accepting malformed source is an alpha release blocker.
Scope
Remove the token-skipping success path from function bodies.
Make every consumed token belong to a successfully parsed declaration, statement, expression, delimiter, or explicit recovery diagnostic.
Consolidate the outer function-body and nested-block statement contracts where practical.
Define and enforce the separator rule for adjacent expression statements.
Add focused negative tests for unsupported infix tokens, missing separators, stray delimiters, and incomplete expressions.
Preserve useful multi-error recovery without reporting a successful compilation.
Acceptance criteria
Both reproducers fail with stable source diagnostics and a nonzero status.
No parser recovery path silently changes program meaning.
Existing valid function bodies and nested blocks continue to parse.
The compiler never panics while rejecting these inputs.
bugA problem that causes incorrect behavior or crashes.criticalAn urgent issue requiring immediate resolution.needs testingIssues that require additional testing or verification.refactorIssues that require code refactoring without changing functionality.
Activity