Skip to content

Preserve local syntax failures in proto method attachment blocks #975

Closed

Description

@LunaStev

Problem

Malformed existing proto Type { ... } blocks use a generic fallback and can highlight the token after the actual invalid target name. The error does not name the missing target identifier, opening brace, or method declaration.

Reproduction

Audited canonical master 42b65e426ad45bf896623b5bce814312b694a0c7 on Linux amd64 with Rust 1.89 and LLVM 21.1.8. Reproductions use the checkout-built target/debug/wavec and matching checkout std. The local head d2f58962 has an identical file tree to that canonical merge. Commands below assume WAVEC names that binary.

proto 123 {}
fun main() {}
"$WAVEC" --error-format=json check main.wave

Observed: failed to parse proto implementation at { (column 11 in the one-line form), after consuming 123. parse_proto contains the discarded target-name and body-token explanations.

Scope

Migrate only the already supported method-attachment grammar to specific ParseError values, preserving exact token spans and nested function errors. Named proto contracts and generic constraints remain #365/#348; do not implement or redesign them here.

Starting points: front/parser/src/parser/items.rs.

Completion criteria

  • Invalid target names, missing opening braces, invalid body tokens and EOF have local context.
  • Nested method signature/body errors retain their own detail.
  • Valid attachments remain unchanged, with human/JSON regression coverage.

Related: #346; #365 and #348 remain separate features.

Activity

  1. self-assigned this
    on Oct 21, 2026
  2. added
    bug
    on Oct 21, 2026
  3. added a commit that references this issue on Oct 22, 2026
    aef39a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions