Skip to content

Commit

Permalink
Fix too strict assertion regarding type of Reset statement
Browse files Browse the repository at this point in the history
Ref. #946
  • Loading branch information
treiher committed Mar 3, 2022
1 parent 1a060d8 commit 8b15a8a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rflx/generator/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -2954,7 +2954,7 @@ def _reset(
reset: stmt.Reset,
is_global: Callable[[ID], bool],
) -> Sequence[Statement]:
assert isinstance(reset.type_, rty.Message)
assert isinstance(reset.type_, (rty.Message, rty.Sequence))

target_type = ID(reset.type_.identifier)
target_context = context_id(reset.identifier, is_global)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ is
Ctx.P.Slots.Slot_Ptr_6 := Message_Options_Buffer;
return;
end if;
Universal.Options.Reset (Message_Options_Ctx);
Ctx.P.Next_State := S_Send_1;
pragma Warnings (Off, """Option_Types_Ctx"" is set by ""Take_Buffer"" but not used after the call");
Universal.Option_Types.Take_Buffer (Option_Types_Ctx, Option_Types_Buffer);
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/session_comprehension_on_sequence/test.rflx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ package Test is
Message_2 := Universal::Message'(Message_Type => Universal::MT_Options,
Length => Message_Options'Size / 8,
Options => Message_Options);
-- §S-S-A-RS-V
Message_Options'Reset;
transition
goto Send_1 -- §S-S-T-N
exception
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/generator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,10 @@ def variables(self) -> Sequence[expr.Variable]:
stmt.Reset("X", type_=rty.Message("P::M")),
"P.M.Reset (X_Ctx);",
),
(
stmt.Reset("X", type_=rty.Sequence("P::S", rty.Integer("A"))),
"P.S.Reset (X_Ctx);",
),
(
stmt.Read("X", expr.Variable("Y", type_=rty.Message("P::M"))),
"P.M.Verify_Message (Y_Ctx);",
Expand Down

0 comments on commit 8b15a8a

Please sign in to comment.