@@ -1278,7 +1278,6 @@ proc my_proc(my_token: token, my_state: bits[32], init={42}) {
12781278}
12791279
12801280TEST (IrParserTest, ParseProcWithExplicitNext) {
1281- // TODO(epastor): Remove the next-value for `my_state` from the last line
12821281 const std::string input = R"( package test
12831282
12841283chan ch(bits[32], id=0, kind=streaming, ops=send_receive, flow_control=none, strictness=proven_mutually_exclusive, metadata="""""")
@@ -1289,14 +1288,33 @@ proc my_proc(my_token: token, my_state: bits[32], init={42}) {
12891288 receive.3: (token, bits[32]) = receive(send.1, predicate=literal.2, channel=ch, id=3)
12901289 tuple_index.4: token = tuple_index(receive.3, index=0, id=4)
12911290 next_value.5: () = next_value(param=my_state, value=my_state, id=5)
1292- next (tuple_index.4, my_state )
1291+ next (tuple_index.4)
12931292}
12941293)" ;
12951294 ParsePackageAndCheckDump (input);
12961295}
12971296
1297+ TEST (IrParserTest, ParseProcWithMixedNextValueStyles) {
1298+ const std::string input = R"( package test
1299+
1300+ chan ch(bits[32], id=0, kind=streaming, ops=send_receive, flow_control=none, strictness=proven_mutually_exclusive, metadata="""""")
1301+
1302+ proc my_proc(my_token: token, my_state_1: bits[32], my_state_2: bits[32], init={42, 64}) {
1303+ send.1: token = send(my_token, my_state_1, channel=ch, id=1)
1304+ literal.2: bits[1] = literal(value=1, id=2)
1305+ receive.3: (token, bits[32]) = receive(send.1, predicate=literal.2, channel=ch, id=3)
1306+ tuple_index.4: token = tuple_index(receive.3, index=0, id=4)
1307+ next_value.5: () = next_value(param=my_state_2, value=my_state_2, id=5)
1308+ next (tuple_index.4, my_state_1, my_state_2)
1309+ }
1310+ )" ;
1311+ EXPECT_THAT (Parser::ParsePackage (input).status (),
1312+ StatusIs (absl::StatusCode::kInvalidArgument ,
1313+ HasSubstr (" Proc includes both next_value nodes (e.g., "
1314+ " next_value.5) and next-state values" )));
1315+ }
1316+
12981317TEST (IrParserTest, ParseProcWithBadNextParam) {
1299- // TODO(epastor): Remove the next-value for `my_state` from the last line
13001318 const std::string input = R"( package test
13011319
13021320chan ch(bits[32], id=0, kind=streaming, ops=send_receive, flow_control=none, strictness=proven_mutually_exclusive, metadata="""""")
@@ -1307,7 +1325,7 @@ proc my_proc(my_token: token, my_state: bits[32], init={42}) {
13071325 receive.3: (token, bits[32]) = receive(send.1, predicate=literal.2, channel=ch, id=3)
13081326 tuple_index.4: token = tuple_index(receive.3, index=0, id=4)
13091327 next_value.5: () = next_value(param=not_my_state, value=my_state, id=5)
1310- next (tuple_index.4, my_state )
1328+ next (tuple_index.4)
13111329}
13121330)" ;
13131331 EXPECT_THAT (Parser::ParsePackage (input).status (),
@@ -1318,7 +1336,6 @@ proc my_proc(my_token: token, my_state: bits[32], init={42}) {
13181336}
13191337
13201338TEST (IrParserTest, ParseProcWithBadNextValueType) {
1321- // TODO(epastor): Remove the next-value for `my_state` from the last line
13221339 const std::string input = R"( package test
13231340
13241341chan ch(bits[32], id=0, kind=streaming, ops=send_receive, flow_control=none, strictness=proven_mutually_exclusive, metadata="""""")
@@ -1329,7 +1346,7 @@ proc my_proc(my_token: token, my_state: bits[32], init={42}) {
13291346 receive.3: (token, bits[32]) = receive(send.1, predicate=literal.2, channel=ch, id=3)
13301347 tuple_index.4: token = tuple_index(receive.3, index=0, id=4)
13311348 next_value.5: () = next_value(param=my_state, value=literal.2, id=5)
1332- next (tuple_index.4, my_state )
1349+ next (tuple_index.4)
13331350}
13341351)" ;
13351352 EXPECT_THAT (Parser::ParsePackage (input).status (),
0 commit comments