-
Notifications
You must be signed in to change notification settings - Fork 8
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
non-definite message in return type of function not allowed #977
Comments
treiher
added
generator
Related to generator package (SPARK code generation)
model
Related to model package (e.g., model verification)
labels
Apr 7, 2022
@jklmnn Can you please add a reproducer to the issue description so we can easily check whether the problem persists? |
This spec reproduces the problem: package Test is
type Message is
message
Data : Opaque;
end message;
generic
Channel : Channel with Writable;
with function Get_Message return Message;
session Session with
Initial => Start,
Final => Terminated
is
Global_Msg : Message;
begin
state Start
is
begin
Global_Msg := Get_Message;
transition
goto Send
end Start;
state Send
is
begin
Channel'Write (Global_Msg);
transition
goto Terminated
end Send;
state Terminated is null state;
end Session;
end Test; It checks fine: rflx check test.rflx
Parsing test.rflx
Processing Test but produces the following error on generate: rflx generate test.rflx -d out
Parsing test.rflx
Processing Test
Generating Test::Message
Generating Test::Session
------------------------------ RecordFlux Bug ------------------------------
RecordFlux 0.6.1.dev6+g69d65226
RecordFlux-parser 0.11.0
attrs 21.4.0
icontract 2.6.2
pydantic 1.9.2
pydotplus 2.0.2
ruamel.yaml 0.17.21
z3-solver 4.10.2.0
Optimized: True
Command: rflx generate test.rflx -d out
Traceback (most recent call last):
File "/.../RecordFlux/rflx/cli.py", line 215, in main
args.func(args)
File "/.../RecordFlux/rflx/cli.py", line 273, in generate
Generator(
File "/.../RecordFlux/rflx/generator/generator.py", line 142, in generate
units = self._generate(model, integration)
File "/.../RecordFlux/rflx/generator/generator.py", line 265, in _generate
units.update(self._create_session(s, integration))
File "/.../RecordFlux/rflx/generator/generator.py", line 282, in _create_session
session_generator = SessionGenerator(
File "/.../RecordFlux/rflx/generator/session.py", line 188, in __init__
self._create()
File "/.../RecordFlux/rflx/generator/session.py", line 218, in _create
state_machine = self._create_state_machine()
File "/.../RecordFlux/rflx/generator/session.py", line 334, in _create_state_machine
unit += self._create_abstract_functions(self._session.parameters.values())
File "/.../RecordFlux/rflx/generator/session.py", line 497, in _create_abstract_functions
result.extend(self._create_abstract_function(parameter))
File "/.../RecordFlux/rflx/generator/session.py", line 538, in _create_abstract_function
fatal_fail(
File "/.../RecordFlux/rflx/error.py", line 198, in fatal_fail
_fail(FatalError(), message, subsystem, severity, location)
File "/.../RecordFlux/rflx/error.py", line 209, in _fail
error.propagate()
File "/.../RecordFlux/rflx/error.py", line 162, in propagate
raise self
rflx.error.FatalError: test.rflx:10:7: generator: error: non-definite message in return type of function "Get_Message" not allowed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm getting the following error when trying to return a non-defined message in a function:
I see why this is not supported (yet) but we may want to print an error message in when checking the spec instead of ending up in a bug box.
The text was updated successfully, but these errors were encountered: