xls icon indicating copy to clipboard operation
xls copied to clipboard

DSLX parsing of nonexistent channel types should be improved.

Open RobSpringer opened this issue 2 years ago • 0 comments

Initially reported by hongted internally:

Running the interpreter on the following proc

import std

proc test_impl {
  in0: chan in ab;
  out0 : chan out u32;

  config(in0: chan in u32,
         out0: chan out u32) {
    (in0, out0)
  }

  next(tok: token, state: u32) {
    let (tok0, i0) = recv(tok, in0);
    let tok_send = send(tok0, out0, i0);

    let state = i0;

    (state,)
  }
}

pub proc proc_main {
  config(in0: chan in u32,
         out0: chan out u32) {
    spawn test_impl(in0, out0)
        (u32:0);
    ()
  }

  next(tok: token) { () }
}

via

interpreter_main test.x --compare="none"

gives an error message of

F0811 10:58:13.208087  255390 parser.h:68] Check failed: completed_ Uncompleted state transaction!

Ideally, the error message should point to the specific line/number or channel with the the error.

  in0: chan in ab;
~~~~~~~~~~~~~~~^^ ParseError: Cannot find a definition for name: 'ab'

The root error here is a missing transaction completion, almost certainly due a missing absl::Cleanup before an XLS_ASSIGN_OR_RETURN type thing.

RobSpringer avatar Aug 11 '22 18:08 RobSpringer