Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logical expressions with booleans are not supported in assignments #1012

Closed
jklmnn opened this issue May 5, 2022 · 0 comments · Fixed by #1020
Closed

Logical expressions with booleans are not supported in assignments #1012

jklmnn opened this issue May 5, 2022 · 0 comments · Fixed by #1020
Assignees
Labels
bug generator Related to generator package (SPARK code generation)

Comments

@jklmnn
Copy link
Member

jklmnn commented May 5, 2022

When I try to assign a boolean expression to a boolean value

Cap_Key_Ex := Plat_Cfg_Cap_Key_Ex and Request.Get_Capabilities_Request_Key_Ex_Cap;

I get the following error in the code generator:

------------------------------ RecordFlux Bug ------------------------------
RecordFlux 0.6.0-pre
RecordFlux-parser 0.10.0
pydantic 1.9.0
attrs 21.4.0
icontract 2.6.1
pydotplus 2.0.2
ruamel.yaml 0.17.21
z3-solver 4.8.17.0

Optimized: False

Command: /tmp/tmp.RsA5OxAgYm/venv/bin/rflx generate build/specs/CHALLENGE_AUTH=True,KEY_EXCHANGE=True,RESPOND_IF_READY=True/spdm_emu.rflx build/specs/CHALLENGE_AUTH=True,KEY_EXCHANGE=True,RESPOND_IF_READY=True/spdm_proxy.rflx build/specs/CHALLENGE_AUTH=True,KEY_EXCHANGE=True,RESPOND_IF_READY=True/spdm_requester.rflx build/specs/CHALLENGE_AUTH=True,KEY_EXCHANGE=True,RESPOND_IF_READY=True/spdm_responder.rflx build/specs/CHALLENGE_AUTH=True,KEY_EXCHANGE=True,RESPOND_IF_READY=True/spdm.rflx --debug -d build/debug/generated

Traceback (most recent call last):
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/cli.py", line 201, in main
    args.func(args)
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/cli.py", line 259, in generate
    generator = Generator(
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/generator.py", line 141, in __init__
    self.__generate(model, integration)
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/generator.py", line 220, in __generate
    self.__create_session(s, integration)
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/generator.py", line 231, in __create_session
    session_generator = SessionGenerator(
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/session.py", line 219, in __init__
    self._create()
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/session.py", line 249, in _create
    state_machine = self._create_state_machine()
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/session.py", line 357, in _create_state_machine
    unit += self._create_states(self._session, composite_globals, is_global)
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/session.py", line 844, in _create_states
    *[
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/session.py", line 847, in <listcomp>
    for s in self._state_action(
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/session.py", line 1893, in _state_action
    result = self._assign(
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/session.py", line 2197, in _assign
    _unexpected_expression(expression, "in assignment")
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/generator/session.py", line 4588, in _unexpected_expression
    fatal_fail(
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/error.py", line 200, in fatal_fail
    _fail(FatalError(), message, subsystem, severity, location)
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/error.py", line 211, in _fail
    error.propagate()
  File "/tmp/tmp.RsA5OxAgYm/venv/lib/python3.9/site-packages/rflx/error.py", line 164, in propagate
    raise self
rflx.error.FatalError: build/specs/CHALLENGE_AUTH=True,KEY_EXCHANGE=True,RESPOND_IF_READY=True/spdm_responder.rflx:311:40: generator: error: unexpected And with enumeration type "__BUILTINS__::Boolean" in assignment

----------------------------------------------------------------------------
@jklmnn jklmnn added the bug label May 5, 2022
@treiher treiher added the generator Related to generator package (SPARK code generation) label May 6, 2022
jklmnn added a commit that referenced this issue May 6, 2022
@jklmnn jklmnn assigned jklmnn and treiher and unassigned jklmnn May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug generator Related to generator package (SPARK code generation)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants