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

Detection of duplicate aspects #714

Closed
treiher opened this issue Jul 28, 2021 · 1 comment · Fixed by #1150
Closed

Detection of duplicate aspects #714

treiher opened this issue Jul 28, 2021 · 1 comment · Fixed by #1150
Assignees
Labels
bug small Effort of one person-day or less specification Related to specification package (e.g., specification parsing)

Comments

@treiher
Copy link
Collaborator

treiher commented Jul 28, 2021

The specification of duplicate aspects shouldn't be accepted (e.g., for First and Size aspects for message fields and Readable and Writable aspects for channels):

package Test is

   type T is mod 2**8;

   type M is
      message
         A : T;
         B : Opaque
            with First => 123, Size => 123, First => A'First, Size => A'Size;
      end message;

   generic
      C : Channel with Readable, Writable, Readable;
   session S with
      Initial => I,
      Final => F
   is
   begin
      state I
      is
         M : Test::M;
      begin
         C'Read (M);
      transition
         then F
      end I;

      state F is null state;
   end S;

end Test;
@treiher treiher added bug specification Related to specification package (e.g., specification parsing) labels Jul 28, 2021
@treiher treiher added this to To do in RecordFlux 0.6 via automation Jul 28, 2021
@treiher treiher added the small Effort of one person-day or less label Aug 9, 2021
@treiher
Copy link
Collaborator Author

treiher commented Feb 3, 2022

The Parser in rflx/specification/parser.py is responsible for parsing a specification and creating a model out of it. For the actual parsing the langkit-based parser is used. The returned AST is evaluated to create a model for all specified types and sessions.

The processing of field aspects (like First and Size) is done here:

https://github.com/Componolit/RecordFlux/blob/227113adac75c458074d76bc4d55f28f508b4d50/rflx/specification/parser.py#L983-L1002

The processing of channel aspects can be found here:

https://github.com/Componolit/RecordFlux/blob/227113adac75c458074d76bc4d55f28f508b4d50/rflx/specification/parser.py#L538-L544

@mhadhbir These are probably the two places where modifications are needed to fix the two problems mentioned in the issue description. The error reporting should be done using an error parameter of type RecordFluxError, as it is done in similar functions. To make the task a bit more challenging, please also have a look at other uses of aspects. For example, messages can have Checksum aspects and transitions in sessions can have Desc aspects. Maybe we have the same issue there. The right place for adding tests is tests/unit/specification/parser_test.py. You can use the existing test_parse_error_* test functions as a guideline.

@treiher treiher moved this from To do to Implementation in RecordFlux 0.6 Feb 3, 2022
mhadhbir added a commit that referenced this issue Feb 9, 2022
This commit introduces extra checks to avoid duplicate aspects for messages and channels.
Closes #714
mhadhbir added a commit that referenced this issue Feb 9, 2022
This commit introduces extra checks to avoid duplicate aspects for messages and channels.
Closes #714
mhadhbir added a commit that referenced this issue Feb 9, 2022
This commit introduces extra checks to avoid duplicate aspects for messages and channels.
Closes #714
mhadhbir added a commit that referenced this issue Feb 9, 2022
This commit introduces extra checks to avoid duplicate aspects for messages and channels.

Closes #714
@mhadhbir mhadhbir moved this from Implementation to Review in RecordFlux 0.6 Feb 9, 2022
mhadhbir added a commit that referenced this issue Feb 15, 2022
mhadhbir added a commit that referenced this issue Feb 15, 2022
mhadhbir added a commit that referenced this issue Feb 15, 2022
mhadhbir added a commit that referenced this issue Feb 16, 2022
mhadhbir added a commit that referenced this issue Feb 17, 2022
mhadhbir added a commit that referenced this issue Feb 17, 2022
mhadhbir added a commit that referenced this issue Feb 17, 2022
mhadhbir added a commit that referenced this issue Feb 17, 2022
mhadhbir added a commit that referenced this issue Feb 17, 2022
mhadhbir added a commit that referenced this issue Feb 18, 2022
@senier senier moved this from Review to To do in RecordFlux 0.6 Mar 1, 2022
@senier senier moved this from To do to Implementation in RecordFlux 0.6 Aug 22, 2022
@senier senier self-assigned this Aug 22, 2022
senier added a commit that referenced this issue Aug 23, 2022
@senier senier moved this from Implementation to Review in RecordFlux 0.6 Aug 23, 2022
senier added a commit that referenced this issue Aug 25, 2022
senier added a commit that referenced this issue Aug 30, 2022
senier added a commit that referenced this issue Aug 30, 2022
RecordFlux 0.6 automation moved this from Review to Done Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug small Effort of one person-day or less specification Related to specification package (e.g., specification parsing)
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants