wavefnd / wavefnd/Wave

Preserve the let-to-var migration diagnostic

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

Description

Tracked by #346.

## Problem

Wave removed local `let` and `let mut` declarations in favor of `var`. Legacy parser code already knows the correct migration message, but the structured top-level error replaces it with a generic "failed to parse function declaration" diagnostic.

## Expected diagnostic

For both forms:

```wave
let value: i32 = 1;
let mut value: i32 = 1;
```

the error should point to `let` and tell the user to use `var`.

## Scope

- Propagate the local declaration failure as a structured parser diagnostic.
- Preserve the exact source span and migration help.
- Keep `let` tokenized only so it can produce this diagnostic; do not restore the syntax.
- Add check/build parity tests for both forms.
- Add a valid `var` control case.

## Completion criteria

- [ ] Human and JSON output identify the `let` token.
- [ ] Help explicitly recommends `var`.
- [ ] `let` and `let mut` remain syntax errors.
- [ ] No diagnostic is printed separately to stdout.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how local declaration failures move from the legacy parser into the structured top-level diagnostic; the issue names no specific files or tests. Add check/build parity coverage for `let`, `let mut`, and valid `var`, then verify human and JSON output preserves the `let` span, recommends `var`, and does not print a separate stdout diagnostic.

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
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.