Skip to content

Point unknown local annotation types at the type instead of the variable name #980

Closed

Description

@LunaStev

Problem

Unknown local annotation types are diagnosed at the variable identifier because validation marks the declaration name before checking the type. This is misleading for long or nested annotations and inconsistent with the parser's type-token diagnostics.

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.

fun main() {
    var x: Undefined;
}
"$WAVEC" --error-format=json check main.wave

Observed: unknown type Undefined in variable x highlights only x, not Undefined. Also reproduced after leading blank lines: JSON line is correct but the span remains the declaration name. The failure is in semantic validation, not parsing.

Scope

Retain and use the physical type annotation range for unknown/invalid annotation diagnostics, including nested pointer/array/generic forms. Keep declaration-name focus for duplicate bindings and expression focus for initializer errors. Do not add type inference or change valid types.

Starting points: front/parser/src/verification.rs, front/parser/src/source.rs, front/parser/src/ast.rs.

Completion criteria

  • Unknown direct/nested local types identify the failing type annotation in human and JSON.
  • Repeated spellings, Unicode and imported source identity are not resolved by text guessing.
  • Duplicate-name and initializer diagnostics retain their appropriate existing spans.

Related: #406 established provenance; #425 and #730 fixed separate syntax/signature paths.

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