Skip to content

Keep less-than comparisons before match arms out of generic parsing #500

Closed

Description

@LunaStev

A valid less-than loop followed by a payload-variant match fails during parsing at the match arm opening brace. Reproduced on master 611cc87 before the local fix:

variant Step { Value(i64), Stop }
fun run(step: Step, limit: i64) {
    var cursor: i64 = 0;
    while (cursor < limit) {
        match step {
            Step::Value(value) => { cursor += value; }
            Step::Stop => { return; }
        }
    }
}
fun main() { run(Step::Value(1), 3); }

wavec check repro.wave reports E2001 at Step::Value(value) => {. Changing the condition to cursor != limit avoids the parse error, so this is not an unsupported match body.

front/parser/src/expr/primary.rs::peek_generic_suffix() only looks for a later closing angle and suffix. The scan can reach a match arrow and mistake ordinary comparisons for generic struct construction. Validate prospective type arguments before committing to generic parsing, while preserving nested generic calls and struct literals.

Acceptance: the minimal regression and a stack-machine program with nested match/loop/early-return paths both parse, type-check and execute; existing generic tests remain green. A local fix and substantive shared runtime regression are being validated; no patch has been committed or pushed yet.

Activity

  1. added
    bug
    good first issue
    needs testing
    on Sep 7, 2026
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

    buggood first issueneeds testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions