Skip to content

Preserve the opening location of unterminated block comments #982

Closed

Description

@LunaStev

Problem

The lexer emits a label saying block comment starts here and never closes, but the primary span is a zero-width EOF location. No related span identifies an unmatched opener, especially when comments nest.

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.

Create main.wave with these exact bytes:

fun main() {}
/* opener
body
"$WAVEC" --error-format=json check main.wave
"$WAVEC" check main.wave

Observed: E1002 at line 4, column 1, with no related location. The actual unmatched /* is line 2. Also executed nested /* outer /* inner : the failure contains no opener span.

Scope

Retain unmatched comment-opening provenance and show it as primary or related location, with expected */. Preserve nesting, newline tracking and bounded behavior. Keep EOF identity available rather than merely relabeling an unrelated byte.

Starting points: front/lexer/src/trivia.rs, front/lexer/src/core.rs.

Completion criteria

  • A lone/nested unmatched comment identifies a real unmatched opening delimiter.
  • Human labels agree with the displayed source location; JSON retains exact byte/Unicode coordinates.
  • LF/CRLF/CR and valid nested comments have regression coverage.

Related: #391 covers comment token tracking; #362 covers syntax-parser delimiters, not lexer comments.

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