Skip to content

Preserve function signature errors at the offending token #730

Closed

Description

@LunaStev

Problem

Function signatures still lose parameter/type/separator details. For an unsupported type, the diagnostic points at the following token instead of the type. A duplicate parameter loses the duplicate-name message entirely.

The relevant code is front/parser/src/parser/functions.rs. Legacy println! calls are silenced by the parser crate's compatibility macro; the resulting CLI output is valid JSON, but its diagnostic is generic.

Reproduction

Save as repro.wave:

fun f(x: i24) {}
target/release/wavec check repro.wave --error-format=human
target/release/wavec check repro.wave --error-format=json

Tested on master 5002a93a4a233032553aa6c6e3639d88e93c53bf with Fedora Linux 43 amd64 and LLVM 21.1.8, using LLVM_SYS_211_PREFIX=/usr/lib64/llvm21 cargo build --locked --release --jobs 2.

Actual: expected valid function parameters, pointing at ) (column 13), instead of identifying i24 (column 10). fun f() -> i24 { return 1; } reports failed to parse function declaration. fun f(x: i32, x: i32) {} similarly loses the duplicate-name cause. Missing : is also reported generically.

Scope

Use existing ParseError helpers and checked type parsing for function/method parameter and return signatures. Preserve specific missing-separator and duplicate-parameter causes. Keep defaults, generic syntax, method rules, and function-body parsing unchanged.

This is a remaining child of #346. #425 fixed extern type paths in decl.rs; this issue is specifically the ordinary function/method path in functions.rs.

Completion criteria

  • Unsupported parameter/return types identify the type start in human and JSON modes.
  • Missing :/, and duplicate names retain their local cause and offending token.
  • Valid ordinary, generic, defaulted, and method signatures remain accepted.
  • Focused parser/CLI regressions cover these paths without relying on suppressed prints.

Activity

  1. added
    bug
    good first issue
    needs testing
    on Sep 25, 2026
  2. self-assigned this
    on Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggood first issueneeds testing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions