Describe the bug
Parsing breaks when the final expression in proc's config function is not a simple tuple, but its type is still a tuple.
To Reproduce
Issue can be reproduced by parsing this example:
const COND = true;
proc Proc {
input: chan<()> in;
output: chan<()> out;
config() {
const if COND {
let (first_output, first_input) = chan<()>("first");
(first_input, first_output)
} else {
let (second_output, second_input) = chan<()>("second");
(second_input, second_output)
}
}
init { () }
next(state: ()) { () }
}
It fails with the following error:
INVALID_ARGUMENT: ParseError: foo.x:9:11-15:6 The final expression in a Proc config must be a tuple with one element for each Proc data member.
Expected behavior
Such expressions can be allowed to pass the parsing stage and generate an error during type checking when the type returned by the final expression is not a matching tuple.