Skip to content

Preserve expected and found values in constructed type-mismatch diagnostics #1024

Closed

Description

@LunaStev

Motivation

WaveError::type_mismatch receives expected/found strings and stores them in the kind/message, but leaves the existing machine-readable expected/found fields empty. A CLI argument mismatch likewise reports types in text while JSON returns expected=[] and found=null; fixing the constructor alone must not be claimed to repair every semantic producer.

Starting point: front/error/src/error.rs:318.

Validation

Audited canonical Wave 540728c2eb6cc12f5c69c3fb3fdb96e07ba059a4 (0.0.1-alpha-dev), whose tree matches the local checkout. Validation: Inspected constructor and executed current CLI type mismatch as a boundary example. Executed compiler probes use the matching checkout-built compiler and std on Linux amd64 (Rust 1.89.0 / LLVM 21.1.8). Source/header or mocked checks are not native execution on another OS.

Scope

Start with the common constructor and callers that already retain these facts. Populate existing fields directly; do not parse human messages or change the JSON schema. Broader semantic fact plumbing can remain separate if needed.

Completion criteria

  • The common constructor serializes the supplied expected/found facts.
  • Covered typed producers preserve their existing messages, spans and diagnostic code.
  • Tests distinguish constructor coverage from still-text-only semantic paths.

This is a bounded, unassigned task with the starting point and focused checks above. Keep unrelated refactoring out of the change.

Activity

  1. added
    enhancement
    good first issue
    on Oct 24, 2026
  2. erenbati commented on Oct 25, 2026

    @erenbati
    Contributor

    I would like to work on this issue. I will add focused regression tests for WaveError::type_mismatch structured expected/found values and existing message/location/code preservation, then update the common constructor without broad semantic-diagnostic plumbing or JSON schema changes. I'll distinguish still-text-only semantic producers in the PR and report test environment limits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions