Closed mgrojo closed 3 weeks ago
It seems to be related with the two functions returning Opaque
. Removing them and initializing the corresponding fields to []
, the exception disappears.
bug_avoided.zip
I've learned that state-machine functions can only return scalars and definite messages, so what should have happened is the raising of an error telling that indefinite types cannot be returned.
I've followed this example to advance with the state machine: https://github.com/AdaCore/RecordFlux/blob/4981cd565d62c68cd9024c452c237b799ea68bcb/examples/apps/spdm_responder/specs/spdm_responder.rflx#L55-L60
I'm sorry for the inconvenience. This bug has been fixed in the meantime (see 49f8edf1f929d1a52748d6f2813ba9f21646a1e3). The specification in bug_input_files.zip
is now correctly rejected:
error: invalid return type
--> coap_client.rflx:8:60
|
8 | with function Get_Request_Options_And_Payload return Opaque;
| ------ help: only scalars and definite messages are allowed
|
error: invalid return type
--> coap_client.rflx:9:45
|
9 | with function Get_Random_Token return Opaque;
| ------ help: only scalars and definite messages are allowed
|
error: invalid variable type
--> coap_client.rflx:19:18
|
19 | Token : Opaque := Get_Random_Token;
| ------ help: use a message with an opaque field instead
|
Opaque
cannot be used as a return type or as a variable. Using a definite message with an Opaque
field instead is the right approach.
A new version, which also contains a fix for this bug, will be released very soon (probably tomorrow).
I've found a bug while generating code for a state machine.
The input files are: bug_input_files.zip