wavefnd / wavefnd/Wave

Migrate local const and static parser failures to structured diagnostics

Open
#394 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue needs testing
Dominant language
Rust
Stars
53
Forks
16
Avg merge
4h 22m
Merged PRs (30d)
46

Description

Tracked by #346.

## Why

Local `const` and `static` declarations are intentionally rejected, but `front/parser/src/parser/stmt.rs` and the for-loop initializer path still print ad-hoc text and return `None`. That loses the stable diagnostic contract used by the rest of the compiler.

## Scope

- Replace only the local `const` and `static` failure paths with `ParseError`/structured diagnostic data.
- Cover ordinary blocks and `for` initializers.
- Point at the qualifier token.
- Explain that both forms are top-level only and suggest `var` for local storage where appropriate.
- Do not change storage-class semantics.

## Completion criteria

- [ ] No direct `println!` is used for these failures.
- [ ] Human diagnostics include context and a useful help message.
- [ ] JSON error output remains valid.
- [ ] Positive top-level `const` and `static` cases remain accepted.
- [ ] Parser or CLI regression tests cover all changed paths.

Contributor guide

Open the contributing guide

Research direction

Start in front/parser/src/parser/stmt.rs and trace the for-loop initializer path where local const and static declarations fail. Replace only those ad-hoc diagnostic paths with structured ParseError data, pointing at the qualifier and preserving top-level acceptance and storage semantics. Add parser or CLI regression coverage for ordinary blocks, for initializers, human and JSON diagnostics, and positive top-level cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.