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

spurious error if specs are given in wrong order #759

Closed
jklmnn opened this issue Aug 31, 2021 · 1 comment · Fixed by #1209
Closed

spurious error if specs are given in wrong order #759

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

Comments

@jklmnn
Copy link
Member

jklmnn commented Aug 31, 2021

If the specs are given in the wrong order and are in different directories RecordFlux emits an error that it could not find the spec. E.g. if a.rflx depends on b.rflx and they're in different directories the following command works:

rflx check b/b.rflx a/a.rflx
Parsing b/b.rflx
Parsing a/a.rflx
Processing A
Processing B

Changing the order of the arguments will lead to an error even though the actual specs are correct and the dependencies are resolved:

rflx check a/a.rflx b/b.rflx
Parsing a/a.rflx
Parsing a/b.rflx
Parsing b/b.rflx
Processing A
Processing B
a/a.rflx:0:0: parser: error: Cannot read b.rflx

a/a.rflx:

with B;

package A is
end A;

b/b.rflx:

package B is
end B;
@jklmnn jklmnn added the bug label Aug 31, 2021
@jklmnn jklmnn added this to To do in RecordFlux 0.6 via automation Aug 31, 2021
@treiher treiher removed this from To do in RecordFlux 0.6 Aug 31, 2021
@treiher treiher added this to To do in RecordFlux 0.7 via automation Aug 31, 2021
@treiher treiher added the specification Related to specification package (e.g., specification parsing) label Aug 31, 2021
@senier senier removed this from To do in RecordFlux 0.7 Aug 23, 2022
@senier senier added this to To do in RecordFlux Future via automation Aug 23, 2022
@senier senier added the small Effort of one person-day or less label Aug 25, 2022
@senier senier removed this from Medium in RecordFlux Future Aug 30, 2022
@senier senier added this to To do in RecordFlux 0.7 via automation Aug 30, 2022
@treiher treiher self-assigned this Sep 26, 2022
@treiher treiher moved this from To do to Implementation in RecordFlux 0.7 Sep 26, 2022
@treiher
Copy link
Collaborator

treiher commented Sep 27, 2022

There are two issues with the current implementation:

  1. A with clause is evaluated as soon as it is found, instead of waiting until all specifications, which are given as arguments, are parsed.
  2. A specification is expected to be located in the same directory as the specification which contains the with clause, if the specification was not parsed before.

Given two specifications a/a.rflx and b/b.rflx, where a/a.rflx is importing C, the current implementation expects to have a file a/c.rflx. Even if both specifications would import C, (1.) would lead to parser error, if b/c.rflx, but no a/c.rflx would exist.

The better solution would be to parse all specification files, which are given as arguments, first, and do the evaluation of imported specifications afterwards. The directories of the given specification files could be considered as the include paths for the search of imported specifications.

treiher added a commit that referenced this issue Oct 4, 2022
treiher added a commit that referenced this issue Oct 4, 2022
@senier senier moved this from Implementation to Review in RecordFlux 0.7 Oct 4, 2022
treiher added a commit that referenced this issue Oct 4, 2022
RecordFlux 0.7 automation moved this from Review to Done Oct 4, 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